示例#1
0
            public void Should_Append_DisableMultiprocessorLogging_If_Specified()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    DisableMultiprocessorLogging = true
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild /consoleloggerparameters:DisableMPLogging", result.Args);
            }
示例#2
0
            public void Should_Append_ShowEventId_If_Specified()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    ShowEventId = true
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild /consoleloggerparameters:ShowEventId", result.Args);
            }
示例#3
0
            public void Should_Append_ForceConsoleColor_If_Specified()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    ConsoleColorType = MSBuildConsoleColorType.ForceAnsi
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild /consoleloggerparameters:ForceConsoleColor", result.Args);
            }
示例#4
0
            public void Should_Append_HideItemAndPropertyList_If_Specified()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    HideItemAndPropertyList = true
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild /consoleloggerparameters:NoItemAndPropertyList", result.Args);
            }
示例#5
0
            public void Should_Not_Append_SummaryOutputLevel_If_Default()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    SummaryOutputLevel = MSBuildLoggerOutputLevel.Default
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild", result.Args);
            }
示例#6
0
            public void Should_Append_SummaryOutputLevel_If_Specified(MSBuildLoggerOutputLevel outputLevel)
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    SummaryOutputLevel = outputLevel
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal($"msbuild /consoleloggerparameters:{outputLevel}", result.Args);
            }
示例#7
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture()
                {
                    Project = "./src/*"
                };

                fixture.GivenProcessExitsWithCode(1);

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, ".NET Core CLI: Process returned an error (exit code 1).");
            }
示例#8
0
            public void Should_Append_Verbosity_If_Specified(DotNetCoreVerbosity verbosity)
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    Verbosity = verbosity
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal($"msbuild /consoleloggerparameters:Verbosity={verbosity}", result.Args);
            }
示例#9
0
            public void Should_Append_FileEncoding_If_Specified()
            {
                // Given
                const string fileEncoding = "UTF8";
                var          fixture      = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings {
                    FileEncoding = fileEncoding
                });

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal($"msbuild /fileLogger /fileloggerparameters:Encoding={fileEncoding}", result.Args);
            }
示例#10
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture()
                {
                    Project  = "./src/*",
                    Settings = new DotNetCoreMSBuildSettings()
                };

                fixture.GivenProcessCannotStart();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, ".NET Core CLI: Process was not started.");
            }
示例#11
0
            public void Should_Add_WarnAsMessage_Argument(MSBuildTreatAllWarningsAs treatAllWarningsAs, string[] errorCodes, string expectedValue)
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.TreatAllWarningsAs = treatAllWarningsAs;

                foreach (var errorCode in errorCodes)
                {
                    fixture.Settings.WarningCodesAsMessage.Add(errorCode);
                }

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal($"msbuild /warnasmessage{expectedValue}", result.Args);
            }
示例#12
0
            public void Should_Add_ConsoleLoggerParameters_If_Specified()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.ConsoleLoggerSettings = new MSBuildLoggerSettings
                {
                    PerformanceSummary = true,
                    SummaryOutputLevel = MSBuildLoggerOutputLevel.ErrorsOnly,
                    Verbosity          = DotNetCoreVerbosity.Diagnostic
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild /consoleloggerparameters:PerformanceSummary;ErrorsOnly;Verbosity=Diagnostic", result.Args);
            }
            public void Should_Append_Binary_Logging_If_Specified(bool enabled, string fileName, MSBuildBinaryLoggerImports imports, string args)
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.BinaryLogger = new MSBuildBinaryLoggerSettings
                {
                    Enabled  = enabled,
                    FileName = fileName,
                    Imports  = imports
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(args, result.Args);
            }
示例#14
0
            public void Should_Add_Multiple_Logger_Arguments_When_Multiple_Values()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.Loggers.Add(new MSBuildLogger {
                    Assembly = "A"
                });
                fixture.Settings.Loggers.Add(new MSBuildLogger {
                    Class = "C", Assembly = "B"
                });
                fixture.Settings.Loggers.Add(new MSBuildLogger {
                    Class = "E", Assembly = "F", Parameters = "g"
                });

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild /logger:\"A\" /logger:C,B /logger:E,F;g", result.Args);
            }
示例#15
0
            public void Should_Throw_If_DistributedLogger_Has_No_Assembly_Value(string centralLoggerAssembly, string forwardingLoggerAssembly)
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.DistributedLoggers.Add(new MSBuildDistributedLogger
                {
                    CentralLogger = new MSBuildLogger {
                        Assembly = centralLoggerAssembly
                    },
                    ForwardingLogger = new MSBuildLogger {
                        Assembly = forwardingLoggerAssembly
                    }
                });

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsArgumentNullException(result, "Assembly");
            }
示例#16
0
            public void Should_Add_DistributedLogger_Argument()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.DistributedLoggers.Add(new MSBuildDistributedLogger
                {
                    CentralLogger = new MSBuildLogger {
                        Assembly = "A"
                    },
                    ForwardingLogger = new MSBuildLogger {
                        Assembly = "B"
                    }
                });

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("msbuild /distributedlogger:\"A\"*\"B\"", result.Args);
            }
示例#17
0
            public void Should_Throw_Exception_For_Too_Many_FileLoggers()
            {
                // Given
                var fixture = new DotNetCoreMSBuildBuilderFixture();

                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());
                fixture.Settings.FileLoggers.Add(new MSBuildFileLoggerSettings());

                // When
                var ex = Assert.Throws <InvalidOperationException>(() => fixture.Run());

                // Then
                Assert.Equal(@"Too Many FileLoggers", ex.Message);
            }