Exemple #1
0
        public void should_set_template_path_on_generator_if_template_switch_given()
        {
            var generator = MockRepository.GenerateMock<IDocumentationGenerator>();
            var app = new ConsoleApplication(StubWriter, generator, StubEventAggregator);

            app.SetArguments(new[] { "--templates=dir" });
            app.Run();

            generator.AssertWasCalled(x => x.SetTemplatePath("dir"));
        }
Exemple #2
0
        public void if_all_good_should_generate()
        {
            var docGen = MockRepository.GenerateMock<IDocumentationGenerator>();
            var app = new ConsoleApplication(StubWriter, docGen);

            app.SetArguments(new[] { "Docu.Tests.dll", "DummyDocs.xml" });
            app.Run();

            docGen.AssertWasCalled(x => x.Generate());
        }
Exemple #3
0
        public void should_pass_xmls_to_docgen()
        {
            var docGen = MockRepository.GenerateMock<IDocumentationGenerator>();
            var app = new ConsoleApplication(StubWriter, docGen);

            app.SetArguments(new[] { "Docu.Tests.dll", "DummyDocs.xml" });
            app.Run();

            docGen.AssertWasCalled(x => x.SetXmlFiles(new string[0]),
                                   x => x.Constraints(List.ContainsAll(new[] { "DummyDocs.xml" })));
        }
Exemple #4
0
        public void should_show_splash_when_has_args()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var app = new ConsoleApplication(writer, StubDocGen, StubEventAggregator);

            app.SetArguments(new[] { "one" });
            app.Run();

            writer.AssertWasCalled(x => x.WriteMessage(null),
                                   x => x.Constraints(Is.TypeOf<SplashMessage>()));
        }
Exemple #5
0
        public void should_show_help_when_empty_args_set()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var app = new ConsoleApplication(writer, StubDocGen, StubEventAggregator);
            
            app.SetArguments(new string[0]);
            app.Run();

            writer.AssertWasCalled(x => x.WriteMessage(null),
                                   x => x.Constraints(Is.TypeOf<HelpMessage>()));
        }
Exemple #6
0
        public void should_show_invalid_message_when_has_bad_arg()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var app = new ConsoleApplication(writer, StubDocGen);

            app.SetArguments(new[] { "one" });
            app.Run();

            writer.AssertWasCalled(x => x.WriteMessage(null),
                                   x => x.Constraints(Is.TypeOf<InvalidArgumentMessage>()));
        }
Exemple #7
0
        public void shouldnt_show_help_when_has_args()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var app = new ConsoleApplication(writer, StubDocGen);

            app.SetArguments(new[] { "one" });
            app.Run();

            writer.AssertWasNotCalled(x => x.WriteMessage(null),
                                   x => x.Constraints(Is.TypeOf<HelpMessage>()));
        }
Exemple #8
0
        public void should_show_help_if_help_switch_given_regardless_of_other_args()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var app = new ConsoleApplication(writer, StubDocGen, StubEventAggregator);

            app.SetArguments(new[] { "Assembly.dll", "--help", "Assembly.xml" });
            app.Run();

            writer.AssertWasCalled(x => x.WriteMessage(null),
                x => x.Constraints(Is.TypeOf<HelpMessage>()));
        }
Exemple #9
0
        public void if_all_good_should_show_done_after_generate()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var docGen = MockRepository.GenerateMock<IDocumentationGenerator>();
            var app = new ConsoleApplication(writer, docGen);

            app.SetArguments(new[] { "Docu.Tests.dll", "DummyDocs.xml" });
            app.Run();

            docGen.AssertWasCalled(x => x.Generate());
            writer.AssertWasCalled(x => x.WriteMessage(null),
                x => x.Constraints(Is.TypeOf<DoneMessage>()));
        }
Exemple #10
0
        public void should_expand_xmls_from_assembly_wildcards_before_passing_to_generator()
        {
            var generator = MockRepository.GenerateMock<IDocumentationGenerator>();
            var app = new ConsoleApplication(StubWriter, generator, StubEventAggregator);

            app.SetArguments(new[] { "Fixtures\\Fake*.dll" });
            app.Run();

            generator.AssertWasCalled(x => x.SetXmlFiles(new[]
            {
                "Fixtures\\FakeAssembly1.xml",
                "Fixtures\\FakeAssembly2.xml",
                "Fixtures\\FakeAssembly3.xml"
            }));
        }
Exemple #11
0
        public void should_expand_assembly_wildcards_in_current_dir()
        {
            var generator = MockRepository.GenerateMock<IDocumentationGenerator>();
            var app = new ConsoleApplication(StubWriter, generator, StubEventAggregator);

            app.SetArguments(new[] { "Docu*.dll", "DummyDocs.xml" });
            app.Run();

            generator.AssertWasCalled(x => x.SetAssemblies(new[] { "Docu.Tests.dll" }));
        }
Exemple #12
0
        public void should_show_missing_xml_message_when_has_bad_xml_arg()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var app = new ConsoleApplication(writer, StubDocGen, StubEventAggregator);

            app.SetArguments(new[] { "Docu.Tests.dll", "missing-file.xml" });
            app.Run();

            writer.AssertWasCalled(x => x.WriteMessage(null),
                                   x => x.Constraints(Is.TypeOf<XmlNotFoundMessage>()));
        }
Exemple #13
0
        public void should_show_missing_assembly_message_when_has_bad_assembly_arg()
        {
            var writer = MockRepository.GenerateMock<IScreenWriter>();
            var app = new ConsoleApplication(writer, StubDocGen);

            app.SetArguments(new[] { "missing-file.dll" });
            app.Run();

            writer.AssertWasCalled(x => x.WriteMessage(null),
                                   x => x.Constraints(Is.TypeOf<AssemblyNotFoundMessage>()));
        }