diff --git a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs index 6c47da2c2b..7f9f2802be 100644 --- a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs @@ -824,5 +824,42 @@ public void should_use_template_name_from_command_line_option() config.NewCommand.TemplateName.ShouldEqual("zip"); } } + + public class when_list_noop_is_called : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + + public override void Because() + { + because = () => service.list_noop(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + public void should_log_template_location_if_no_template_name() + { + because(); + + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(1); + infos[0].ShouldEqual("Would have listed templates in {0}".format_with(ApplicationParameters.TemplatesLocation)); + } + + [Fact] + public void should_log_template_name_if_template_name() + { + config.TemplateCommand.Name = "msi"; + because(); + + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(1); + infos[0].ShouldEqual("Would have listed information about {0}".format_with(config.TemplateCommand.Name)); + } + } } }