public void ResponseFileEntireCommandLine(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { NoLogo = true, ResponseFiles = { Path.GetTempFileName() }, }; string responseFilePath = Path.GetTempFileName(); try { commandLineArguments.ToString(responseFilePath, useShortSwitchNames).ShouldBe($"@\"{responseFilePath}\""); string responseFileContents = File.ReadAllText(responseFilePath); responseFileContents.ShouldBe($"/NoLogo @\"{commandLineArguments.ResponseFiles.First()}\""); } finally { foreach (string file in commandLineArguments.ResponseFiles.Concat(new[] { responseFilePath })) { File.Delete(file); } } }
public void LoggerParametersMultipleTest(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments(); commandLineArguments.DistributedLoggers.Add(new MSBuildDistributedLoggerParameters { CentralLogger = new MSBuildLoggerParameters { Assembly = "MyLogger,Version=1.0.2,Culture=neutral", ClassName = "XMLLogger", Parameters = "1 2 3", }, ForwardingLogger = new MSBuildLoggerParameters { Assembly = "ForwardingLogger,Version=1.0,Culture=neutral", ClassName = "XMLLogger", } }); commandLineArguments.DistributedLoggers.Add(new MSBuildDistributedLoggerParameters { CentralLogger = new MSBuildLoggerParameters { Assembly = "MyLogger2,Version=1.0.3,Culture=neutral", ClassName = "XMLLogger3", }, ForwardingLogger = new MSBuildLoggerParameters { Assembly = "ForwardingLogger2,Version=1.0.0,Culture=neutral", ClassName = "XMLLogger2", } }); commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"\"/{GetSwitchName(useShortSwitchNames)}:{commandLineArguments.DistributedLoggers.First().CentralLogger.ClassName},{commandLineArguments.DistributedLoggers.First().CentralLogger.Assembly};{commandLineArguments.DistributedLoggers.First().CentralLogger.Parameters}*{commandLineArguments.DistributedLoggers.First().ForwardingLogger.ClassName},{commandLineArguments.DistributedLoggers.First().ForwardingLogger.Assembly}\" \"/{GetSwitchName(useShortSwitchNames)}:{commandLineArguments.DistributedLoggers.Last().CentralLogger.ClassName},{commandLineArguments.DistributedLoggers.Last().CentralLogger.Assembly}*{commandLineArguments.DistributedLoggers.Last().ForwardingLogger.ClassName},{commandLineArguments.DistributedLoggers.Last().ForwardingLogger.Assembly}\""); }
public void ResponseFileSingleTest() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments(); commandLineArguments.ResponseFiles.Add(@"C:\foo bar\bar.txt"); commandLineArguments.ToString().ShouldBe($"@\"{commandLineArguments.ResponseFiles.First()}\""); }
public void IgnoreProjectExtensionsSingle(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments(); commandLineArguments.IgnoreProjectExtensions.Add(".sln"); commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}:{String.Join(";", commandLineArguments.IgnoreProjectExtensions)}"); }
public void PreProcessCustom(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { PreProcess = "Custom.xml", }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}:{commandLineArguments.PreProcess}"); }
public void NoAutoResponseFalse() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { NoAutoResponse = false, }; commandLineArguments.ToString().ShouldBeEmpty(); }
public void MaxCpuCountZeroAndNegative(bool useShortSwitchNames, int maxCpuCount) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { MaxCpuCount = maxCpuCount }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}"); }
public void MaxCpuCountPositiveNumber(bool useShortSwitchNames, int maxCpuCount) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { MaxCpuCount = maxCpuCount }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}:{maxCpuCount}"); }
public void ConsoleLoggerParametersNotNullButEmpty() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { ConsoleLoggerParameters = new MSBuildConsoleLoggerParameters(), }; commandLineArguments.ToString().ShouldBe(""); }
public void DetailedSummaryTrue(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { DetailedSummary = true, }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}"); }
public void ProjectNull() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { Project = null, }; commandLineArguments.ToString().ShouldBeEmpty(); }
public void ProjectSpecifiedWithSpaces() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { Project = @"C:\path to\a\project file\foo.csproj", }; commandLineArguments.ToString().ShouldBe($"\"{commandLineArguments.Project}\""); }
public void ProjectSpecified() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { Project = @"C:\path\to\a\project\file\foo.csproj", }; commandLineArguments.ToString().ShouldBe($"{commandLineArguments.Project}"); }
public void ValidateCustom(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { Validate = "Custom.xsd", }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}:{commandLineArguments.Validate}"); }
public void VersionFalse() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { Version = false, }; commandLineArguments.ToString().ShouldBeEmpty(); }
public void DetailedSummaryFalse() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { DetailedSummary = false, }; commandLineArguments.ToString().ShouldBeEmpty(); }
public void PreProcessDefault(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { PreProcess = String.Empty, }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}"); }
public void NoAutoResponseTrue(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { NoAutoResponse = true, }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}"); }
public void VersionTrue(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { Version = true, }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}"); }
public void DistributedFileLoggerTrue(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { DistributedFileLogger = true }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}"); }
public void DistributedFileLoggerFalse() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { DistributedFileLogger = false }; commandLineArguments.ToString().ShouldBeEmpty(); }
public void BinaryLoggerParametersNotNullButEmpty(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { BinaryLogger = new MSBuildBinaryLoggerParameters(), }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}"); }
public void NoConsoleLoggerFalse() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { NoConsoleLogger = false, }; commandLineArguments.ToString().ShouldBeEmpty(); }
public void NoLogoTrue() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { NoLogo = true, }; commandLineArguments.ToString().ShouldBe("/NoLogo"); }
public void NodeReuse(bool useShortSwitchNames, bool nodeResuse) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { NodeReuse = nodeResuse, }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}:{nodeResuse}"); }
public void ResponseFileMultipleTest() { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments(); commandLineArguments.ResponseFiles.Add(@"C:\foo bar\bar1.txt"); commandLineArguments.ResponseFiles.Add(@"C:\foo bar\bar2.txt"); commandLineArguments.ResponseFiles.Add(@"C:\foo bar\bar3.txt"); commandLineArguments.ToString().ShouldBe($"@\"{String.Join("\" @\"", commandLineArguments.ResponseFiles)}\""); }
public void TargetSingle(bool useShortSwitchNames) { const string target = "Test"; MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments(); commandLineArguments.Targets.Add(target); commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}:{target}"); }
public void FileLoggerSingleEncoding(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments(); commandLineArguments.FileLoggers.Add(new MSBuildFileLoggerParameters { Encoding = "Unicode" }); commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)} /{GetSecondarySwitchName(useShortSwitchNames)}:Encoding={commandLineArguments.FileLoggers.First().Encoding}"); }
public void ToolsVersion(bool useShortSwitchNames) { const string toolsVersion = "Test"; MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments { ToolsVersion = toolsVersion, }; commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)}:{toolsVersion}"); }
public void FileLoggerSingleLogFile(bool useShortSwitchNames) { MSBuildCommandLineArguments commandLineArguments = new MSBuildCommandLineArguments(); commandLineArguments.FileLoggers.Add(new MSBuildFileLoggerParameters { LogFile = "my log.log" }); commandLineArguments.ToString(useShortSwitchNames: useShortSwitchNames).ShouldBe($"/{GetSwitchName(useShortSwitchNames)} /{GetSecondarySwitchName(useShortSwitchNames)}:\"LogFile={commandLineArguments.FileLoggers.First().LogFile}\""); }