public VSTestTaskTests() { this.vsTestTask = new VSTestTask { TestFileFullPath = @"C:\path\to\test-assembly.dll", VSTestFramework = ".NETCoreapp,Version2.0" }; }
public void CreateArgumentShouldSetConsoleLoggerVerbosityToNormalIfConsoleLoggerIsNotGivenInArgsAndVerbosityIsnormal() { var vstestTask = new VSTestTask { VSTestVerbosity = "normal" }; // Add values for required properties. vstestTask.TestFileFullPath = "abc"; vstestTask.VSTestFramework = "abc"; var allArguments = vstestTask.CreateArgument().ToArray(); Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:Console;Verbosity=normal"))); }
public void CreateArgumentShouldPreserveWhiteSpaceInLogger() { var vstestTask = new VSTestTask(); // Add values for required properties. vstestTask.TestFileFullPath = "abc"; vstestTask.VSTestFramework = "abc"; vstestTask.VSTestLogger = "trx;LogFileName=foo bar.trx"; var allArguments = vstestTask.CreateArgument().ToArray(); Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:\"trx;LogFileName=foo bar.trx\""))); }
public void CreateArgumentShouldPassResultsDirectoryCorrectly() { const string resultsDirectoryValue = @"C:\tmp\ResultsDirectory"; var vstestTask = new VSTestTask { VSTestResultsDirectory = resultsDirectoryValue }; // Add values for required properties. vstestTask.TestFileFullPath = "abc"; vstestTask.VSTestFramework = "abc"; var result = vstestTask.CreateArgument().ToArray(); Assert.AreEqual($"--resultsDirectory:\"{resultsDirectoryValue}\"", result[1]); }
public void CreateArgumentShouldAddOneCollectArgumentForEachCollect() { var vstestTask = new VSTestTask { VSTestCollect = new string[2] }; // Add values for required properties. vstestTask.TestFileFullPath = "abc"; vstestTask.VSTestFramework = "abc"; vstestTask.VSTestCollect[0] = "name1"; vstestTask.VSTestCollect[1] = "name2"; var allArguments = vstestTask.CreateArgument().ToArray(); Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--collect:name1"))); Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--collect:name2"))); }
public void CreateArgumentShouldAddDoubleQuotesForCLIRunSettings() { const string arg1 = "RunConfiguration.ResultsDirectory=Path having Space"; const string arg2 = "MSTest.DeploymentEnabled"; var vstestTask = new VSTestTask { VSTestCLIRunSettings = new string[2] }; vstestTask.VSTestCLIRunSettings[0] = arg1; vstestTask.VSTestCLIRunSettings[1] = arg2; // Add values for required properties. vstestTask.TestFileFullPath = "abc"; vstestTask.VSTestFramework = "abc"; var result = vstestTask.CreateArgument().ToArray(); // First, second and third args would be --framework:abc, testfilepath and -- respectively. Assert.AreEqual($"\"{arg1}\"", result[3]); Assert.AreEqual($"\"{arg2}\"", result[4]); }