Пример #1
0
        public void If_a_CSBuild_exception_is_thrown_no_stacktrace_should_be_written()
        {
            var consoleOutput = new FakeConsoleOutput();
            PrepareInstance<IOutput>(new OutputService(consoleOutput));
            var br = CreateInstance<BuildRunner>();
            A.CallTo(() => Fake<ITaskRegistrationValidator>().Validate()).Throws(new SomeCsBuildException("Stuff happend"));

            br.RunBuild();

            StringAssert.DoesNotContain("Exception", consoleOutput.ToString());
            StringAssert.Contains("Stuff happend", consoleOutput.ToString());
        }
Пример #2
0
        public void Displaying_the_task_list_should_display_all_task_names_and_descriptions()
        {
            var consoleOutput = new FakeConsoleOutput();
            PrepareInstance<IOutput>(new OutputService(consoleOutput));
            var helpWriter = CreateInstance<HelpWriter>();
            A.CallTo(() => Fake<ITaskRegistration>().Tasks).Returns(new[]
            {
                new RegisteredTask(typeof(ExampleTask0)) {Description = "Description"}
            });

            helpWriter.WriteTasks();

            StringAssert.Contains("ExampleTask0", consoleOutput.ToString());
            StringAssert.Contains("Description", consoleOutput.ToString());
        }
Пример #3
0
        public void Dryrun_should_output_the_graph()
        {
            var t1 = new RegisteredTask(typeof(ExampleTask0));
            var t2 = new RegisteredTask(typeof(ExampleTask1));
            var t3 = new RegisteredTask(typeof(ExampleTask2));

            var output = new FakeConsoleOutput();
            PrepareInstance<IOutput>(new OutputService(output));
            var dryrun = CreateInstance<Dryrun>();

            A.CallTo(() => Fake<ITaskGraphResolver>().Resolve(t3)).Returns(new[] {t1, t2, t3});
            A.CallTo(() => Fake<IRequestedTask>().Current).Returns(t3);

            dryrun.Run();

            StringAssert.Contains(nameof(ExampleTask2), output.Lines.First());
            StringAssert.Contains(nameof(ExampleTask1), output.ToString());
            StringAssert.Contains(nameof(ExampleTask0), output.ToString());
        }