Update test code to use netcoreapp2.1

This commit is contained in:
Daniel Plaisted 2017-08-18 15:36:01 -07:00
parent c00afe9588
commit dc4046ca7e
14 changed files with 30 additions and 30 deletions

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{ {
string projectDirectory = directory.Path; string projectDirectory = directory.Path;
string newArgs = "console -f netcoreapp2.0 --debug:ephemeral-hive --no-restore"; string newArgs = "console -f netcoreapp2.1 --debug:ephemeral-hive --no-restore";
new NewCommandShim() new NewCommandShim()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.Execute(newArgs) .Execute(newArgs)
@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes) new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes)
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput( .ExecuteWithCapturedOutput(
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp2.0 portable") $"-d dependency-tool-invoker -c {configuration} -f netcoreapp2.1 portable")
.Should().Pass() .Should().Pass()
.And.HaveStdOutContaining("Hello Portable World!");; .And.HaveStdOutContaining("Hello Portable World!");;
} }

View file

@ -198,7 +198,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var command = factory.Create("dotnet-tool-with-output-name", null); var command = factory.Create("dotnet-tool-with-output-name", null);
command.CommandArgs.Should().Contain( command.CommandArgs.Should().Contain(
Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp2.0", "dotnet-tool-with-output-name.dll")); Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp2.1", "dotnet-tool-with-output-name.dll"));
} }
} }
} }

View file

@ -375,7 +375,7 @@ namespace Microsoft.DotNet.Tests
"dotnet-fallbackfoldertool", "dotnet-fallbackfoldertool",
"1.0.0", "1.0.0",
"lib", "lib",
"netcoreapp2.0", "netcoreapp2.1",
"dotnet-fallbackfoldertool.dll")); "dotnet-fallbackfoldertool.dll"));
} }

View file

@ -107,7 +107,7 @@ namespace Microsoft.DotNet.Cli.Package.Add.Tests
var packageName = "Newtonsoft.Json"; var packageName = "Newtonsoft.Json";
var packageVersion = "9.0.1"; var packageVersion = "9.0.1";
var framework = "netcoreapp2.0"; var framework = "netcoreapp2.1";
var cmd = new DotnetCommand() var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"add package {packageName} --version {packageVersion} --framework {framework}"); .ExecuteWithCapturedOutput($"add package {packageName} --version {packageVersion} --framework {framework}");

View file

@ -29,7 +29,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp2.0") var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp2.1")
.GetFile($"{testAppName}.dll"); .GetFile($"{testAppName}.dll");
var outputRunCommand = new DotnetCommand(); var outputRunCommand = new DotnetCommand();
@ -66,7 +66,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
new BuildCommand() new BuildCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.Execute("--framework netcoreapp2.0") .Execute("--framework netcoreapp2.1")
.Should().Pass(); .Should().Pass();
} }
@ -93,7 +93,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
string dir = "pkgs"; string dir = "pkgs";
string args = $"--packages {dir}"; string args = $"--packages {dir}";
string newArgs = $"console -f netcoreapp2.0 -o \"{rootPath}\" --debug:ephemeral-hive --no-restore"; string newArgs = $"console -f netcoreapp2.1 -o \"{rootPath}\" --debug:ephemeral-hive --no-restore";
new NewCommandShim() new NewCommandShim()
.WithWorkingDirectory(rootPath) .WithWorkingDirectory(rootPath)
.Execute(newArgs) .Execute(newArgs)
@ -115,7 +115,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Directory.EnumerateFiles( var outputDll = Directory.EnumerateFiles(
Path.Combine(rootPath, "bin", configuration, "netcoreapp2.0"), "*.dll", Path.Combine(rootPath, "bin", configuration, "netcoreapp2.1"), "*.dll",
SearchOption.TopDirectoryOnly) SearchOption.TopDirectoryOnly)
.Single(); .Single();

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Clean.Tests
.Should().Pass(); .Should().Pass();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputFolder = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp2.0", "win7-x64"); var outputFolder = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp2.1", "win7-x64");
outputFolder.Should().NotBeEmpty(); outputFolder.Should().NotBeEmpty();

View file

@ -33,11 +33,11 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.Execute("--framework netcoreapp2.0") .Execute("--framework netcoreapp2.1")
.Should().Pass(); .Should().Pass();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp2.0", "publish", $"{testAppName}.dll"); var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp2.1", "publish", $"{testAppName}.dll");
new DotnetCommand() new DotnetCommand()
.ExecuteWithCapturedOutput(outputDll) .ExecuteWithCapturedOutput(outputDll)
@ -57,7 +57,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.Execute("--framework netcoreapp2.0") .Execute("--framework netcoreapp2.1")
.Should().Pass(); .Should().Pass();
} }
@ -74,7 +74,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.Execute("--framework netcoreapp2.0") .Execute("--framework netcoreapp2.1")
.Should().Pass(); .Should().Pass();
} }
@ -90,7 +90,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp2.0 --no-restore") .ExecuteWithCapturedOutput("--framework netcoreapp2.1 --no-restore")
.Should().Fail() .Should().Fail()
.And.HaveStdOutContaining("project.assets.json"); .And.HaveStdOutContaining("project.assets.json");
} }
@ -110,7 +110,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
new PublishCommand() new PublishCommand()
.WithFramework("netcoreapp2.0") .WithFramework("netcoreapp2.1")
.WithRuntime(rid) .WithRuntime(rid)
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.Execute() .Execute()
@ -119,7 +119,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputProgram = testProjectDirectory var outputProgram = testProjectDirectory
.GetDirectory("bin", configuration, "netcoreapp2.0", rid, "publish", $"{testAppName}{Constants.ExeSuffix}") .GetDirectory("bin", configuration, "netcoreapp2.1", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
.FullName; .FullName;
EnsureProgramIsRunnable(outputProgram); EnsureProgramIsRunnable(outputProgram);
@ -185,7 +185,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
return testProjectDirectory return testProjectDirectory
.GetDirectory("bin", configuration, "netcoreapp2.0", rid, "publish"); .GetDirectory("bin", configuration, "netcoreapp2.1", rid, "publish");
} }
private static void EnsureProgramIsRunnable(string path) private static void EnsureProgramIsRunnable(string path)
@ -227,7 +227,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputProgram = rootDir var outputProgram = rootDir
.GetDirectory("bin", configuration, "netcoreapp2.0", "publish", $"{rootDir.Name}.dll") .GetDirectory("bin", configuration, "netcoreapp2.1", "publish", $"{rootDir.Name}.dll")
.FullName; .FullName;
new TestCommand(outputProgram) new TestCommand(outputProgram)

View file

@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
new RunCommand() new RunCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp2.0") .ExecuteWithCapturedOutput("--framework netcoreapp2.1")
.Should().Pass() .Should().Pass()
.And.HaveStdOutContaining("This string came from the test library!"); .And.HaveStdOutContaining("This string came from the test library!");
} }
@ -131,7 +131,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
new RunCommand() new RunCommand()
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp2.0") .ExecuteWithCapturedOutput("--framework netcoreapp2.1")
.Should().Pass() .Should().Pass()
.And.HaveStdOutContaining("Hello World!"); .And.HaveStdOutContaining("Hello World!");
} }

View file

@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
{ {
public class GivenDotnetStoresAndPublishesProjects : TestBase public class GivenDotnetStoresAndPublishesProjects : TestBase
{ {
private static string _tfm = "netcoreapp2.0"; private static string _tfm = "netcoreapp2.1";
private static string _frameworkVersion = TestAssetInstance.CurrentRuntimeFrameworkVersion; private static string _frameworkVersion = TestAssetInstance.CurrentRuntimeFrameworkVersion;
private static string _arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant(); private static string _arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant();

View file

@ -40,8 +40,8 @@ namespace Microsoft.DotNet.Cli.Test.Tests
result.StdOut result.StdOut
.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.", "because .NET 4.6 tests will pass") .Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.", "because .NET 4.6 tests will pass")
.And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTestDesktop", "because .NET 4.6 tests will pass") .And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTestDesktop", "because .NET 4.6 tests will pass")
.And.Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.", "because netcoreapp2.0 tests will fail") .And.Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.", "because netcoreapp2.1 tests will fail")
.And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp", "because netcoreapp2.0 tests will fail"); .And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp", "because netcoreapp2.1 tests will fail");
} }
result.ExitCode.Should().Be(1); result.ExitCode.Should().Be(1);
} }
@ -97,7 +97,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
new DotnetTestCommand() new DotnetTestCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"{TestBase.ConsoleLoggerOutputNormal} --framework netcoreapp2.0") .ExecuteWithCapturedOutput($"{TestBase.ConsoleLoggerOutputNormal} --framework netcoreapp2.1")
.Should().Pass(); .Should().Pass();
} }
} }

View file

@ -117,7 +117,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("5"); var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("5");
string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
string expectedError = Path.Combine(testProjectDirectory, "bin", string expectedError = Path.Combine(testProjectDirectory, "bin",
configuration, "netcoreapp2.0", "VSTestCore.dll"); configuration, "netcoreapp2.1", "VSTestCore.dll");
expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found."; expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found.";
// Call test // Call test

View file

@ -31,7 +31,7 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests
.Should().Pass(); .Should().Pass();
var outputDll = testRoot var outputDll = testRoot
.GetDirectory("bin", configuration, "netcoreapp2.0") .GetDirectory("bin", configuration, "netcoreapp2.1")
.GetFile($"{testAppName}.dll"); .GetFile($"{testAppName}.dll");
var argsForVstest = $"\"{outputDll.FullName}\" --logger:console;verbosity=normal"; var argsForVstest = $"\"{outputDll.FullName}\" --logger:console;verbosity=normal";

View file

@ -57,7 +57,7 @@ namespace Microsoft.DotNet.Tests
_testInstance.Root.FullName, _testInstance.Root.FullName,
"bin", "bin",
configuration, configuration,
"netcoreapp2.0", "netcoreapp2.1",
"publish", "publish",
"VBTestApp.dll"); "VBTestApp.dll");

View file

@ -175,7 +175,7 @@ namespace Microsoft.DotNet.Tests
".tools", ".tools",
toolName); toolName);
// Other tests may have restored the tool for netcoreapp2.0, so delete its tools folder // Other tests may have restored the tool for netcoreapp2.1, so delete its tools folder
if (Directory.Exists(toolFolder)) if (Directory.Exists(toolFolder))
{ {
Directory.Delete(toolFolder, true); Directory.Delete(toolFolder, true);
@ -423,7 +423,7 @@ namespace Microsoft.DotNet.Tests
.WithRestoreFiles(); .WithRestoreFiles();
var assetsFile = new DirectoryInfo(new RepoDirectoriesProvider().NugetPackages) var assetsFile = new DirectoryInfo(new RepoDirectoriesProvider().NugetPackages)
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp2.0") .GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp2.1")
.GetFile("project.assets.json"); .GetFile("project.assets.json");
var stopWatch = Stopwatch.StartNew(); var stopWatch = Stopwatch.StartNew();