public void SetUp()
 {
     State = new BuildStateService();
     Progress = new BuildProgress();
     TaskMonitor = new TaskMonitor(Progress, State);
     Output = new FakeConsoleOutput();
     Writer = new BuildSummaryWriter(Progress, new OutputService(Output));
 }
Exemple #2
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());
        }
Exemple #3
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());
        }
Exemple #4
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());
        }