diff --git a/eng/Versions.props b/eng/Versions.props
index f6f97d4b41d9..d7c1b62d956d 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -64,7 +64,8 @@
- 9.4.0
+ 13.1.2
+ 10.3.0
- net6.0
+ $(MiddlewareTargetFrameworkV6)
true
MicrosoftAspNetCore
diff --git a/src/Dotnet.Watch/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj b/src/Dotnet.Watch/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj
index 6391d60021e1..08da1da07ff5 100644
--- a/src/Dotnet.Watch/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj
+++ b/src/Dotnet.Watch/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj
@@ -1,19 +1,21 @@
+
+
- net6.0;net10.0
+ $(AgentTargetFrameworkV6);$(AgentTargetFrameworkV10)
MicrosoftAspNetCore
true
-
+
diff --git a/src/Dotnet.Watch/HotReloadAgent.Host/Microsoft.DotNet.HotReload.Agent.Host.Package.csproj b/src/Dotnet.Watch/HotReloadAgent.Host/Microsoft.DotNet.HotReload.Agent.Host.Package.csproj
index b5630dcc8e6e..afefaead9178 100644
--- a/src/Dotnet.Watch/HotReloadAgent.Host/Microsoft.DotNet.HotReload.Agent.Host.Package.csproj
+++ b/src/Dotnet.Watch/HotReloadAgent.Host/Microsoft.DotNet.HotReload.Agent.Host.Package.csproj
@@ -1,13 +1,14 @@
+
- net6.0;net10.0
+ $(AgentTargetFrameworkV6);$(AgentTargetFrameworkV10)
true
false
@@ -27,7 +28,7 @@
-
+
diff --git a/src/Dotnet.Watch/HotReloadAgent/Microsoft.DotNet.HotReload.Agent.Package.csproj b/src/Dotnet.Watch/HotReloadAgent/Microsoft.DotNet.HotReload.Agent.Package.csproj
index d44f61dd98ca..39c923c17161 100644
--- a/src/Dotnet.Watch/HotReloadAgent/Microsoft.DotNet.HotReload.Agent.Package.csproj
+++ b/src/Dotnet.Watch/HotReloadAgent/Microsoft.DotNet.HotReload.Agent.Package.csproj
@@ -1,10 +1,11 @@
+
- net6.0
+ $(AgentTargetFrameworkV6)
false
none
false
diff --git a/src/Dotnet.Watch/Watch/RuntimeDependencies.props b/src/Dotnet.Watch/Watch/RuntimeDependencies.props
index 7d4d40a9ab8d..45b8138bed6a 100644
--- a/src/Dotnet.Watch/Watch/RuntimeDependencies.props
+++ b/src/Dotnet.Watch/Watch/RuntimeDependencies.props
@@ -1,11 +1,13 @@
+
+
None
true
false
TargetFramework;TargetFrameworks
- hotreload\net6.0\Microsoft.AspNetCore.Watch.BrowserRefresh.dll
+ hotreload\$(MiddlewareTargetFrameworkV6)\Microsoft.AspNetCore.Watch.BrowserRefresh.dll
PreserveNewest
+
+
+ net6.0
+
+
+ net10.0
+
+
+ net6.0
+
+
diff --git a/src/Dotnet.Watch/Web.Middleware/Microsoft.DotNet.HotReload.Web.Middleware.Package.csproj b/src/Dotnet.Watch/Web.Middleware/Microsoft.DotNet.HotReload.Web.Middleware.Package.csproj
index 5bdde90926bf..f0c45e354c83 100644
--- a/src/Dotnet.Watch/Web.Middleware/Microsoft.DotNet.HotReload.Web.Middleware.Package.csproj
+++ b/src/Dotnet.Watch/Web.Middleware/Microsoft.DotNet.HotReload.Web.Middleware.Package.csproj
@@ -1,11 +1,12 @@
+
- net6.0
+ $(MiddlewareTargetFrameworkV6)
true
false
diff --git a/src/Dotnet.Watch/dotnet-watch/Watch/DotNetWatcher.cs b/src/Dotnet.Watch/dotnet-watch/Watch/DotNetWatcher.cs
index 650aa1b16ff3..607abeddc2b2 100644
--- a/src/Dotnet.Watch/dotnet-watch/Watch/DotNetWatcher.cs
+++ b/src/Dotnet.Watch/dotnet-watch/Watch/DotNetWatcher.cs
@@ -58,7 +58,8 @@ public static async Task WatchAsync(DotNetWatchContext context, CancellationToke
{
[EnvironmentVariables.Names.DotnetWatch] = "1",
[EnvironmentVariables.Names.DotnetWatchIteration] = (iteration + 1).ToString(CultureInfo.InvariantCulture),
- }
+ },
+ OnOutput = line => context.ProcessOutputReporter.ReportOutput(line)
};
var browserRefreshServer = projectRootNode != null && HotReloadAppModel.InferFromProject(context, projectRootNode) is WebApplicationAppModel webAppModel
diff --git a/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs b/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs
index 219e689c8fde..306c8bc2a92f 100644
--- a/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs
+++ b/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs
@@ -250,7 +250,7 @@ private string[] RawEvaluateArgumentString(string testUserArgument)
{
StartInfo = new ProcessStartInfo
{
- FileName = TestContext.Current.ToolsetUnderTest.DotNetHostPath,
+ FileName = SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath,
Arguments = $"{ReflectorPath} {testUserArgument}",
UseShellExecute = false,
RedirectStandardOutput = true,
diff --git a/test/Common/Program.cs b/test/Common/Program.cs
index f2100b6811cf..7f54298c0d3b 100644
--- a/test/Common/Program.cs
+++ b/test/Common/Program.cs
@@ -68,7 +68,7 @@ private static int ShowSdkInfo()
{
var log = new StringTestLogger();
var command = new DotnetCommand(log, "--info");
- var testDirectory = TestDirectory.Create(Path.Combine(TestContext.Current.TestExecutionDirectory, "sdkinfo"));
+ var testDirectory = TestDirectory.Create(Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "sdkinfo"));
command.WorkingDirectory = testDirectory.Path;
diff --git a/test/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs b/test/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs
index 2de14aa9ad59..ffc22bf79144 100644
--- a/test/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs
+++ b/test/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs
@@ -59,7 +59,7 @@ public void ItCanRunToolsInACSProj()
project.Root.Add(itemGroup);
});
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
new RestoreCommand(testInstance)
.Execute()
@@ -93,7 +93,7 @@ public void ItCanRunToolsThatPrefersTheCliRuntimeEvenWhenTheToolItselfDeclaresAD
project.Root.Add(itemGroup);
});
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
new RestoreCommand(testInstance)
.Execute()
diff --git a/test/EndToEnd.Tests/ProjectBuildTests.cs b/test/EndToEnd.Tests/ProjectBuildTests.cs
index ae176eb62ca8..b237a16e7a6c 100644
--- a/test/EndToEnd.Tests/ProjectBuildTests.cs
+++ b/test/EndToEnd.Tests/ProjectBuildTests.cs
@@ -402,7 +402,7 @@ public void ItCanCreateAndBuildTemplatesWithDefaultFramework_DisableBuildOnLinux
private static string DetectExpectedDefaultFramework(string template = "")
{
- string dotnetFolder = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
+ string dotnetFolder = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
string[] runtimeFolders = Directory.GetDirectories(Path.Combine(dotnetFolder, "shared", "Microsoft.NETCore.App"));
int latestMajorVersion = runtimeFolders.Select(folder => int.Parse(Path.GetFileName(folder).Split('.').First())).Max();
if (latestMajorVersion == 10)
@@ -468,7 +468,7 @@ XDocument GetProjectXml()
$"/bl:{templateName}-{(selfContained ? "selfcontained" : "fdd")}-{language}-{framework}-{{}}.binlog"
];
- string dotnetRoot = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
+ string dotnetRoot = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
new DotnetBuildCommand(Log, projectDirectory)
.WithEnvironmentVariable("PATH", dotnetRoot) // override PATH since razor rely on PATH to find dotnet
.WithWorkingDirectory(projectDirectory)
diff --git a/test/EndToEnd.Tests/ValidateInsertedManifests.cs b/test/EndToEnd.Tests/ValidateInsertedManifests.cs
index e16a446e0a12..7581c27a316a 100644
--- a/test/EndToEnd.Tests/ValidateInsertedManifests.cs
+++ b/test/EndToEnd.Tests/ValidateInsertedManifests.cs
@@ -12,7 +12,7 @@ public class ValidateInsertedManifests(ITestOutputHelper log) : SdkTest(log)
[Fact]
public void ManifestReaderCanReadManifests()
{
- var sdkManifestDir = Path.Combine(Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath), "sdk-manifests");
+ var sdkManifestDir = Path.Combine(Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath), "sdk-manifests");
var sdkversionDir = new DirectoryInfo(sdkManifestDir).EnumerateDirectories().First();
foreach (var manifestVersionDir in sdkversionDir.EnumerateDirectories())
{
diff --git a/test/EndToEnd.Tests/VersionTests.cs b/test/EndToEnd.Tests/VersionTests.cs
index 4c7eb3687cb0..d3bc2223148d 100644
--- a/test/EndToEnd.Tests/VersionTests.cs
+++ b/test/EndToEnd.Tests/VersionTests.cs
@@ -13,7 +13,7 @@ public void DotnetVersionReturnsCorrectVersion()
var result = new DotnetCommand(Log).Execute("--version");
result.Should().Pass();
- var dotnetFolder = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
+ var dotnetFolder = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
var sdkFolders = Directory.GetDirectories(Path.Combine(dotnetFolder, "sdk"));
sdkFolders.Length.Should().Be(1, "Only one SDK folder is expected in the layout");
diff --git a/test/Microsoft.DotNet.HotReload.Test.Utilities/WatchableApp.cs b/test/Microsoft.DotNet.HotReload.Test.Utilities/WatchableApp.cs
index f858d5026a27..2dacad1cb33a 100644
--- a/test/Microsoft.DotNet.HotReload.Test.Utilities/WatchableApp.cs
+++ b/test/Microsoft.DotNet.HotReload.Test.Utilities/WatchableApp.cs
@@ -19,7 +19,7 @@ internal sealed class WatchableApp(
: IAsyncDisposable
{
public static WatchableApp CreateDotnetWatchApp(ITestOutputHelper logger)
- => new(logger, TestContext.Current.ToolsetUnderTest.DotNetHostPath, "watch", ["-bl"]);
+ => new(logger, SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath, "watch", ["-bl"]);
public DebugTestOutputLogger Logger { get; } = new DebugTestOutputLogger(logger);
@@ -204,6 +204,10 @@ public ProcessStartInfo GetProcessStartInfo(string workingDirectory, string test
info.Environment.Add("Microsoft_CodeAnalysis_EditAndContinue_LogDir", testOutputPath);
info.Environment.Add("DOTNET_CLI_CONTEXT_VERBOSE", "trace");
+ // Aspire DCP logging:
+ info.Environment.Add("DCP_DIAGNOSTICS_LOG_FOLDER", Path.Combine(testOutputPath, "dcp"));
+ info.Environment.Add("DCP_DIAGNOSTICS_LOG_LEVEL", "debug");
+
// suppress all timeouts:
info.Environment.Add("DCP_IDE_REQUEST_TIMEOUT_SECONDS", "100000");
info.Environment.Add("DCP_IDE_NOTIFICATION_TIMEOUT_SECONDS", "100000");
@@ -217,7 +221,7 @@ public ProcessStartInfo GetProcessStartInfo(string workingDirectory, string test
info.Environment[name] = value;
}
- TestContext.Current.AddTestEnvironmentVariables(info.Environment);
+ SdkTestContext.Current.AddTestEnvironmentVariables(info.Environment);
return info;
}
diff --git a/test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/AspireLauncherTests.cs b/test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/AspireLauncherTests.cs
index 6a02ec6ab4c8..101319f315b4 100644
--- a/test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/AspireLauncherTests.cs
+++ b/test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/AspireLauncherTests.cs
@@ -17,14 +17,14 @@ private WatchableApp CreateHostApp()
Logger,
executablePath: Path.ChangeExtension(typeof(AspireLauncher).Assembly.Location, PathUtilities.ExecutableExtension).TrimEnd('.'),
commandName: "host",
- commandArguments: ["--sdk", TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest]);
+ commandArguments: ["--sdk", SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest]);
private WatchableApp CreateServerApp(string serverPipe)
=> new(
Logger,
executablePath: Path.ChangeExtension(typeof(AspireLauncher).Assembly.Location, PathUtilities.ExecutableExtension).TrimEnd('.'),
commandName: "server",
- commandArguments: ["--sdk", TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "--server", serverPipe]);
+ commandArguments: ["--sdk", SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "--server", serverPipe]);
private WatchableApp CreateResourceApp(string serverPipe)
=> new(
diff --git a/test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs b/test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs
index ad6997c03cca..9c34805166d7 100644
--- a/test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs
+++ b/test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs
@@ -100,7 +100,7 @@ public string GetIdentifier() {
public string CreateTestTool(ITestOutputHelper log, TestToolSettings toolSettings, bool collectBinlogs = true)
{
- var targetDirectory = Path.Combine(TestContext.Current.TestExecutionDirectory, "TestTools", toolSettings.GetIdentifier());
+ var targetDirectory = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "TestTools", toolSettings.GetIdentifier());
var testProject = new TestProject(toolSettings.ToolPackageId)
{
diff --git a/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageDownloaderTests.cs b/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageDownloaderTests.cs
index 32f6f731397a..405758c66408 100644
--- a/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageDownloaderTests.cs
+++ b/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageDownloaderTests.cs
@@ -26,7 +26,7 @@ internal class DotnetEnvironmentTestFixture : IDisposable
public DotnetEnvironmentTestFixture()
{
- string dotnetRootUnderTest = TestContext.Current.ToolsetUnderTest.DotNetRoot;
+ string dotnetRootUnderTest = SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
_originalPath = Environment.GetEnvironmentVariable(_PATH_VAR_NAME);
Environment.SetEnvironmentVariable(_PATH_VAR_NAME, dotnetRootUnderTest + Path.PathSeparator + _originalPath);
}
@@ -730,7 +730,7 @@ public void GivenARootWithNonAsciiCharacterInstallSucceeds()
WriteNugetConfigFile(fileSystem, nugetConfigPath, true);
- var testRuntimeJsonPath = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
+ var testRuntimeJsonPath = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
var downloader = new ToolPackageDownloader(
store: store,
@@ -899,7 +899,7 @@ private static void AssertInstallRollBack(IFileSystem fileSystem, IToolPackageSt
store = storeAndQuery;
storeQuery = storeAndQuery;
downloader = new ToolPackageDownloaderMock2(storeAndQuery,
- runtimeJsonPathForTests: TestContext.GetRuntimeGraphFilePath(),
+ runtimeJsonPathForTests: SdkTestContext.GetRuntimeGraphFilePath(),
currentWorkingDirectory: root.Value,
fileSystem);
@@ -912,7 +912,7 @@ private static void AssertInstallRollBack(IFileSystem fileSystem, IToolPackageSt
var toolPackageStore = new ToolPackageStoreAndQuery(toolsRoot);
store = toolPackageStore;
storeQuery = toolPackageStore;
- var testRuntimeJsonPath = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
+ var testRuntimeJsonPath = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
downloader = new ToolPackageDownloader(store, testRuntimeJsonPath, root.Value);
uninstaller = new ToolPackageUninstaller(store);
}
diff --git a/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageInstallerNugetCacheTests.cs b/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageInstallerNugetCacheTests.cs
index 761bcc03b6a4..e46fbd816822 100644
--- a/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageInstallerNugetCacheTests.cs
+++ b/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageInstallerNugetCacheTests.cs
@@ -139,7 +139,7 @@ private static List GetMockFeedsForConfigFile(FilePath nugetConfig)
{
fileSystem = new FileSystemWrapper();
store = new ToolPackageStoreAndQuery(root);
- var runtimeJsonPathForTests = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
+ var runtimeJsonPathForTests = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
downloader = new ToolPackageDownloader(store, runtimeJsonPathForTests);
}
diff --git a/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageUninstallerTests.cs b/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageUninstallerTests.cs
index 95d13c5229a2..4a02b2551e47 100644
--- a/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageUninstallerTests.cs
+++ b/test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageUninstallerTests.cs
@@ -106,7 +106,7 @@ private static List GetMockFeedsForSource(string source)
var toolPackageStore = new ToolPackageStoreAndQuery(root);
store = toolPackageStore;
storeQuery = toolPackageStore;
- var testRuntimeJsonPath = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
+ var testRuntimeJsonPath = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
downloader = new ToolPackageDownloader(store, testRuntimeJsonPath);
uninstaller = new ToolPackageUninstaller(store);
}
diff --git a/test/Microsoft.DotNet.TemplateLocator.Tests/GivenAnTemplateLocator.cs b/test/Microsoft.DotNet.TemplateLocator.Tests/GivenAnTemplateLocator.cs
index 71664197df6c..683d2f90dd7e 100644
--- a/test/Microsoft.DotNet.TemplateLocator.Tests/GivenAnTemplateLocator.cs
+++ b/test/Microsoft.DotNet.TemplateLocator.Tests/GivenAnTemplateLocator.cs
@@ -15,7 +15,7 @@ public GivenAnTemplateLocator(ITestOutputHelper logger) : base(logger)
{
_resolver = new TemplateLocator(Environment.GetEnvironmentVariable, null, VSSettings.Ambient, null, null);
_fakeDotnetRootDirectory =
- Path.Combine(TestContext.Current.TestExecutionDirectory, Path.GetRandomFileName());
+ Path.Combine(SdkTestContext.Current.TestExecutionDirectory, Path.GetRandomFileName());
var fakeSdkDirectory = Path.Combine(_fakeDotnetRootDirectory, "sdk", "5.0.102");
Directory.CreateDirectory(fakeSdkDirectory);
@@ -64,7 +64,7 @@ public void GivenNoSdkToBondItShouldReturnEmpty()
public void GivenNoManifestDirectoryItShouldReturnEmpty()
{
var fakeDotnetRootDirectory =
- Path.Combine(TestContext.Current.TestExecutionDirectory, Path.GetRandomFileName());
+ Path.Combine(SdkTestContext.Current.TestExecutionDirectory, Path.GetRandomFileName());
var result = _resolver.GetDotnetSdkTemplatePackages("5.0.102", fakeDotnetRootDirectory, userProfileDir: null);
result.Should().BeEmpty();
}
diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs
index a9c05a3b247b..1293348dec60 100644
--- a/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs
+++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs
@@ -555,7 +555,7 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
if (addPackageReference)
{
- File.Copy(Path.Combine(TestContext.Current.TestExecutionDirectory, "NuGet.config"), Path.Combine(newProjectDir.FullName, "NuGet.config"));
+ File.Copy(Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "NuGet.config"), Path.Combine(newProjectDir.FullName, "NuGet.config"));
(string? packagePath, string? packageVersion) = ToolsetUtils.GetContainersPackagePath();
@@ -725,7 +725,7 @@ public void EndToEnd_NoAPI_Console(string baseImage)
.Should().Pass();
ChangeTargetFrameworkAfterAppCreation(newProjectDir.FullName);
- File.Copy(Path.Combine(TestContext.Current.TestExecutionDirectory, "NuGet.config"), Path.Combine(newProjectDir.FullName, "NuGet.config"));
+ File.Copy(Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "NuGet.config"), Path.Combine(newProjectDir.FullName, "NuGet.config"));
(string? packagePath, string? packageVersion) = ToolsetUtils.GetContainersPackagePath();
diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/FullFramework/CreateNewImageToolTaskTests.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/FullFramework/CreateNewImageToolTaskTests.cs
index cfffd3a8ca47..4d2ff7f82b4e 100644
--- a/test/Microsoft.NET.Build.Containers.IntegrationTests/FullFramework/CreateNewImageToolTaskTests.cs
+++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/FullFramework/CreateNewImageToolTaskTests.cs
@@ -596,6 +596,6 @@ public void GenerateCommandLineCommands_LabelGeneration()
private static string GetPathToContainerize()
{
- return Path.Combine(TestContext.Current.TestExecutionDirectory, "Container", "containerize");
+ return Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "Container", "containerize");
}
}
diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/PackageTests.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/PackageTests.cs
index aec5b31d6651..db1a7aff703e 100644
--- a/test/Microsoft.NET.Build.Containers.IntegrationTests/PackageTests.cs
+++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/PackageTests.cs
@@ -23,7 +23,7 @@ public void SanityTest_ContainerizeDependencies()
"..\\..\\Cli\\Microsoft.DotNet.Cli.Utils\\Microsoft.DotNet.Cli.Utils.csproj"
};
- string projectFilePath = Path.Combine(TestContext.Current.TestExecutionDirectory, "Container", "ProjectFiles", "containerize.csproj");
+ string projectFilePath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "Container", "ProjectFiles", "containerize.csproj");
XDocument project = XDocument.Load(projectFilePath);
XNamespace ns = project.Root?.Name.Namespace ?? throw new InvalidOperationException("Project file is empty");
@@ -53,7 +53,7 @@ public void SanityTest_NET_Build_ContainersDependencies()
"..\\..\\Microsoft.Extensions.Logging.MSBuild\\Microsoft.Extensions.Logging.MSBuild.csproj"
};
- string projectFilePath = Path.Combine(TestContext.Current.TestExecutionDirectory, "Container", "ProjectFiles", "Microsoft.NET.Build.Containers.csproj");
+ string projectFilePath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "Container", "ProjectFiles", "Microsoft.NET.Build.Containers.csproj");
XDocument project = XDocument.Load(projectFilePath);
XNamespace ns = project.Root?.Name.Namespace ?? throw new InvalidOperationException("Project file is empty");
diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/ProjectInitializer.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/ProjectInitializer.cs
index 89f1f16f2b4c..e182f2666593 100644
--- a/test/Microsoft.NET.Build.Containers.IntegrationTests/ProjectInitializer.cs
+++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/ProjectInitializer.cs
@@ -14,7 +14,7 @@ public sealed class ProjectInitializer
static ProjectInitializer()
{
- var artifactPackagingDirectory = Path.Combine(TestContext.Current.TestExecutionDirectory, "Container", "packaging");
+ var artifactPackagingDirectory = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "Container", "packaging");
var targetsFile = Path.Combine(artifactPackagingDirectory, "Microsoft.NET.Build.Containers.targets");
var propsFile = Path.ChangeExtension(targetsFile, ".props");
_combinedTargetsLocation = CombineFiles(propsFile, targetsFile);
diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/TestSettings.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/TestSettings.cs
index 7240fff45640..a3be36ddcc89 100644
--- a/test/Microsoft.NET.Build.Containers.IntegrationTests/TestSettings.cs
+++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/TestSettings.cs
@@ -23,7 +23,7 @@ internal static string TestArtifactsDirectory
{
if (_testArtifactsDir == null)
{
- string tmpDir = Path.Combine(TestContext.Current.TestExecutionDirectory, "ContainersTests", DateTime.Now.ToString("yyyyMMddHHmmssfff", CultureInfo.InvariantCulture));
+ string tmpDir = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "ContainersTests", DateTime.Now.ToString("yyyyMMddHHmmssfff", CultureInfo.InvariantCulture));
if (!Directory.Exists(tmpDir))
{
Directory.CreateDirectory(tmpDir);
diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/ToolsetUtils.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/ToolsetUtils.cs
index 58fda7c074e7..310c7b571094 100644
--- a/test/Microsoft.NET.Build.Containers.IntegrationTests/ToolsetUtils.cs
+++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/ToolsetUtils.cs
@@ -11,7 +11,7 @@ internal static class ToolsetUtils
///
internal static string GetRuntimeGraphFilePath()
{
- return TestContext.GetRuntimeGraphFilePath();
+ return SdkTestContext.GetRuntimeGraphFilePath();
}
internal static IManifestPicker RidGraphManifestPicker { get; } = new RidGraphManifestPicker(GetRuntimeGraphFilePath());
@@ -22,12 +22,12 @@ internal static string GetRuntimeGraphFilePath()
///
internal static (string? PackagePath, string? PackageVersion) GetContainersPackagePath()
{
- string packageDir = Path.Combine(TestContext.Current.TestExecutionDirectory, "Container", "package");
+ string packageDir = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "Container", "package");
//until the package is stabilized, the package version matches TestContext.Current.ToolsetUnderTest.SdkVersion
//after the package is stabilized, the package version doesn't have -prefix (-dev, -ci) anymore
//so one of those is expected
- string?[] expectedPackageVersions = new[] { TestContext.Current.ToolsetUnderTest?.SdkVersion, TestContext.Current.ToolsetUnderTest?.SdkVersion?.Split('-')[0] };
+ string?[] expectedPackageVersions = new[] { SdkTestContext.Current.ToolsetUnderTest?.SdkVersion, SdkTestContext.Current.ToolsetUnderTest?.SdkVersion?.Split('-')[0] };
foreach (string? expectedVersion in expectedPackageVersions)
{
diff --git a/test/Microsoft.NET.Build.Tests/AppHostTests.cs b/test/Microsoft.NET.Build.Tests/AppHostTests.cs
index 1ae4ea8f5bd0..98dea2152d10 100644
--- a/test/Microsoft.NET.Build.Tests/AppHostTests.cs
+++ b/test/Microsoft.NET.Build.Tests/AppHostTests.cs
@@ -71,7 +71,7 @@ public void It_builds_a_runnable_apphost_by_default(string targetFramework)
new RunExeCommand(Log, Path.Combine(outputDirectory.FullName, hostExecutable))
.WithEnvironmentVariable(
Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)",
- Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath))
+ Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath))
.Execute()
.Should()
.Pass()
diff --git a/test/Microsoft.NET.Build.Tests/AspNetCoreOnFullFramework.cs b/test/Microsoft.NET.Build.Tests/AspNetCoreOnFullFramework.cs
index d8f054e5a780..87195e80147e 100644
--- a/test/Microsoft.NET.Build.Tests/AspNetCoreOnFullFramework.cs
+++ b/test/Microsoft.NET.Build.Tests/AspNetCoreOnFullFramework.cs
@@ -87,7 +87,7 @@ class Class1
{
FileName = exePath
};
- TestContext.Current.AddTestEnvironmentVariables(toolCommandSpec.Environment);
+ SdkTestContext.Current.AddTestEnvironmentVariables(toolCommandSpec.Environment);
ICommand toolCommand = toolCommandSpec.ToCommand().CaptureStdOut();
diff --git a/test/Microsoft.NET.Build.Tests/DeleteNuGetArtifactsFixture.cs b/test/Microsoft.NET.Build.Tests/DeleteNuGetArtifactsFixture.cs
index 1882ea5f89c8..a7a004812f5d 100644
--- a/test/Microsoft.NET.Build.Tests/DeleteNuGetArtifactsFixture.cs
+++ b/test/Microsoft.NET.Build.Tests/DeleteNuGetArtifactsFixture.cs
@@ -38,7 +38,7 @@ private void DeleteNuGetArtifacts()
try
{
// Delete the generated NuGet packages in the cache.
- foreach (string dir in Directory.EnumerateDirectories(TestContext.Current.NuGetCachePath, ConstantStringValues.DependencyDirectoryNamePrefix + "*"))
+ foreach (string dir in Directory.EnumerateDirectories(SdkTestContext.Current.NuGetCachePath, ConstantStringValues.DependencyDirectoryNamePrefix + "*"))
{
Directory.Delete(dir, true);
}
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantDiagnosticsWhenPackageCannotBeFound.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantDiagnosticsWhenPackageCannotBeFound.cs
index 5bda5b9484c0..bfc62fd7cfcc 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantDiagnosticsWhenPackageCannotBeFound.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantDiagnosticsWhenPackageCannotBeFound.cs
@@ -56,13 +56,13 @@ private static void RemovePackageFromCache(TestPackageReference package)
// only that file here to confirm that behavior and mitigate risk of a typo
// here resulting in an overly aggressive recursive directory deletion.
var shaFile = Path.Combine(
- TestContext.Current.NuGetCachePath,
+ SdkTestContext.Current.NuGetCachePath,
package.ID,
package.Version,
$"{package.ID}.{package.Version}.nupkg.sha512");
var nupkgMetadataFile = Path.Combine(
- TestContext.Current.NuGetCachePath,
+ SdkTestContext.Current.NuGetCachePath,
package.ID,
package.Version,
$".nupkg.metadata");
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs
index d9e91404efff..e44be356a506 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopExeWtihNetStandardLib.cs
@@ -208,7 +208,7 @@ public void It_resolves_conflicts(bool isSdk, bool usePackagesConfig)
target.Add(new XElement(ns + "FindUnderPath",
new XAttribute("Files", "@(_ConflictPackageFiles)"),
- new XAttribute("Path", TestContext.Current.ToolsetUnderTest.GetMicrosoftNETBuildExtensionsPath()),
+ new XAttribute("Path", SdkTestContext.Current.ToolsetUnderTest.GetMicrosoftNETBuildExtensionsPath()),
new XElement(ns + "Output",
new XAttribute("TaskParameter", "InPath"),
new XAttribute("ItemName", "_ConflictsInSupportLibs"))
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopLibrary.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopLibrary.cs
index 86d8da4dd6b5..c0a2945ff4d7 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopLibrary.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopLibrary.cs
@@ -437,12 +437,12 @@ public void It_uses_hintpath_when_replacing_simple_name_references(bool useFacad
string correctHttpReference;
if (useFacades)
{
- string microsoftNETBuildExtensionsPath = TestContext.Current.ToolsetUnderTest.GetMicrosoftNETBuildExtensionsPath();
+ string microsoftNETBuildExtensionsPath = SdkTestContext.Current.ToolsetUnderTest.GetMicrosoftNETBuildExtensionsPath();
correctHttpReference = Path.Combine(microsoftNETBuildExtensionsPath, @"net461\lib\System.Net.Http.dll");
}
else
{
- correctHttpReference = Path.Combine(TestContext.Current.NuGetCachePath, "system.net.http", "4.3.2", "ref", "net46", "System.Net.Http.dll");
+ correctHttpReference = Path.Combine(SdkTestContext.Current.NuGetCachePath, "system.net.http", "4.3.2", "ref", "net46", "System.Net.Http.dll");
}
var valuesWithMetadata = getValuesCommand.GetValuesWithMetadata();
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
index 3aa930a5f476..9ee3c2684e88 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
@@ -389,7 +389,7 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform(
{
if (targetPlatformIdentifier.Equals("windows", StringComparison.OrdinalIgnoreCase))
{
- var sdkVersion = SemanticVersion.Parse(TestContext.Current.ToolsetUnderTest.SdkVersion);
+ var sdkVersion = SemanticVersion.Parse(SdkTestContext.Current.ToolsetUnderTest.SdkVersion);
if (new SemanticVersion(sdkVersion.Major, sdkVersion.Minor, sdkVersion.Patch) < new SemanticVersion(7, 0, 200))
{
// Fixed in 7.0.200: https://github.com/dotnet/sdk/pull/29009
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs
index 8bd78958485f..6250362883b7 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreApp.cs
@@ -59,7 +59,7 @@ public void It_targets_the_right_shared_framework(string targetFramework, string
[InlineData("netcoreapp1.1", true, true, "1.1.13")]
[InlineData("netcoreapp1.1", false, false, "1.1.2")]
[InlineData("netcoreapp2.0", false, true, "2.0.0")]
- [InlineData("netcoreapp2.0", true, true, TestContext.LatestRuntimePatchForNetCoreApp2_0)]
+ [InlineData("netcoreapp2.0", true, true, SdkTestContext.LatestRuntimePatchForNetCoreApp2_0)]
[InlineData("netcoreapp2.0", false, false, "2.0.0")]
public void It_targets_the_right_framework_depending_on_output_type(string targetFramework, bool selfContained, bool isExe, string expectedFrameworkVersion)
{
@@ -101,10 +101,10 @@ public void The_RuntimeFrameworkVersion_can_float()
// Test that the resolved version is greater than or equal to the latest runtime patch
// we know about, so that when a new runtime patch is released the test doesn't
// immediately start failing
- var minimumExpectedVersion = new NuGetVersion(TestContext.LatestRuntimePatchForNetCoreApp2_0);
+ var minimumExpectedVersion = new NuGetVersion(SdkTestContext.LatestRuntimePatchForNetCoreApp2_0);
netCoreAppLibrary.Version.CompareTo(minimumExpectedVersion).Should().BeGreaterThanOrEqualTo(0,
"the version resolved from a RuntimeFrameworkVersion of '{0}' should be at least {1}",
- testProject.RuntimeFrameworkVersion, TestContext.LatestRuntimePatchForNetCoreApp2_0);
+ testProject.RuntimeFrameworkVersion, SdkTestContext.LatestRuntimePatchForNetCoreApp2_0);
}
private void It_targets_the_right_framework(
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs
index fb10507bf61f..98d57d53cf69 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs
@@ -281,7 +281,7 @@ static int Last2DigitsTo0(int versionBuild)
var testAsset = _testAssetsManager.CreateTestProject(testProject);
// Set up test workload manifest that will suply targeting and runtime pack versions
- string sdkVersionBand = GetVersionBand(TestContext.Current.ToolsetUnderTest.SdkVersion);
+ string sdkVersionBand = GetVersionBand(SdkTestContext.Current.ToolsetUnderTest.SdkVersion);
string manifestRoot = Path.Combine(testAsset.TestRoot, "manifests");
string manifestFolder = Path.Combine(manifestRoot, sdkVersionBand, "RuntimePackVersionTestWorkload");
Directory.CreateDirectory(manifestFolder);
@@ -349,7 +349,7 @@ public void It_can_publish_runtime_specific_apps_with_library_dependencies_self_
{
// There's a bug when using the 6.0 SDK with 17.4 but we have limited control over the VS version used in helix
- Version.TryParse(TestContext.Current.ToolsetUnderTest.MSBuildVersion, out Version msbuildVersion);
+ Version.TryParse(SdkTestContext.Current.ToolsetUnderTest.MSBuildVersion, out Version msbuildVersion);
Version.TryParse("17.4.0", out Version maximumVersion);
if (msbuildVersion >= maximumVersion)
return;
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
index 382259bff48c..71eb0d44224c 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
@@ -195,7 +195,7 @@ public void It_succeeds_if_windows_target_platform_version_does_not_have_trailin
{
if (!setInTargetframework)
{
- var sdkVersion = SemanticVersion.Parse(TestContext.Current.ToolsetUnderTest.SdkVersion);
+ var sdkVersion = SemanticVersion.Parse(SdkTestContext.Current.ToolsetUnderTest.SdkVersion);
if (new SemanticVersion(sdkVersion.Major, sdkVersion.Minor, sdkVersion.Patch) < new SemanticVersion(7, 0, 200))
{
// Fixed in 7.0.200: https://github.com/dotnet/sdk/pull/29009
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateADepsFileForATool.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateADepsFileForATool.cs
index 163a3cc9005f..76f13d3ad5eb 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateADepsFileForATool.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToGenerateADepsFileForATool.cs
@@ -93,8 +93,8 @@ static void Main(string[] args)
// This method duplicates a lot of logic from the CLI in order to test generating deps files for tools in the SDK repo
private CommandResult GenerateDepsAndRunTool(TestProject toolProject, [CallerMemberName] string callingMethod = "")
{
- DeleteFolder(Path.Combine(TestContext.Current.NuGetCachePath, toolProject.Name.ToLowerInvariant()));
- DeleteFolder(Path.Combine(TestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant()));
+ DeleteFolder(Path.Combine(SdkTestContext.Current.NuGetCachePath, toolProject.Name.ToLowerInvariant()));
+ DeleteFolder(Path.Combine(SdkTestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant()));
var toolProjectInstance = _testAssetsManager.CreateTestProject(toolProject, callingMethod, identifier: toolProject.Name);
@@ -135,13 +135,13 @@ private CommandResult GenerateDepsAndRunTool(TestProject toolProject, [CallerMem
var restoreCommand = toolReferencerInstance.GetRestoreCommand(Log, toolReferencer.Name);
restoreCommand.Execute("/v:n").Should().Pass();
- string toolAssetsFilePath = Path.Combine(TestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant(), "1.0.0", toolProject.TargetFrameworks, "project.assets.json");
+ string toolAssetsFilePath = Path.Combine(SdkTestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant(), "1.0.0", toolProject.TargetFrameworks, "project.assets.json");
var toolAssetsFile = new LockFileFormat().Read(toolAssetsFilePath);
var args = new List();
- string currentToolsetSdksPath = TestContext.Current.ToolsetUnderTest.SdksPath;
+ string currentToolsetSdksPath = SdkTestContext.Current.ToolsetUnderTest.SdksPath;
string generateDepsProjectDirectoryPath = Path.Combine(currentToolsetSdksPath, "Microsoft.NET.Sdk", "targets", "GenerateDeps");
string generateDepsProjectFileName = "GenerateDeps.proj";
@@ -226,10 +226,10 @@ private CommandResult GenerateDepsAndRunTool(TestProject toolProject, [CallerMem
var toolCommandSpec = new SdkCommandSpec()
{
- FileName = TestContext.Current.ToolsetUnderTest.DotNetHostPath,
+ FileName = SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath,
Arguments = dotnetArgs
};
- TestContext.Current.AddTestEnvironmentVariables(toolCommandSpec.Environment);
+ SdkTestContext.Current.AddTestEnvironmentVariables(toolCommandSpec.Environment);
toolCommandSpec.Environment.Add("DOTNET_ROLL_FORWARD","LatestMajor");
ICommand toolCommand = toolCommandSpec.ToCommand().CaptureStdOut();
diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs
index a781be1741ce..0c53dfabdade 100644
--- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs
+++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs
@@ -346,18 +346,18 @@ public void It_resolves_multitargeted_analyzers()
static readonly List nugetRoots = new()
{
- TestContext.Current.NuGetCachePath,
+ SdkTestContext.Current.NuGetCachePath,
Path.Combine(CliFolderPathCalculator.DotnetHomePath, ".dotnet", "NuGetFallbackFolder"),
- Path.Combine(TestContext.Current.ToolsetUnderTest.DotNetRoot, "packs")
+ Path.Combine(SdkTestContext.Current.ToolsetUnderTest.DotNetRoot, "packs")
};
static (string package, string version, string path) GetPackageAndPath(string absolutePath)
{
absolutePath = Path.GetFullPath(absolutePath);
- if (absolutePath.StartsWith(TestContext.Current.ToolsetUnderTest.SdksPath))
+ if (absolutePath.StartsWith(SdkTestContext.Current.ToolsetUnderTest.SdksPath))
{
- string path = absolutePath.Substring(TestContext.Current.ToolsetUnderTest.SdksPath.Length + 1)
+ string path = absolutePath.Substring(SdkTestContext.Current.ToolsetUnderTest.SdksPath.Length + 1)
.Replace(Path.DirectorySeparatorChar, '/');
var components = path.Split(new char[] { '/' }, 2);
string sdkName = components[0];
diff --git a/test/Microsoft.NET.Build.Tests/WorkloadTests.cs b/test/Microsoft.NET.Build.Tests/WorkloadTests.cs
index 62d9ab500dd4..17715dd91579 100644
--- a/test/Microsoft.NET.Build.Tests/WorkloadTests.cs
+++ b/test/Microsoft.NET.Build.Tests/WorkloadTests.cs
@@ -269,7 +269,7 @@ public void It_should_get_suggested_workload_by_GetRequiredWorkloads_target()
public void Given_multi_target_It_should_get_suggested_workload_by_GetRequiredWorkloads_target(string mainTfm, string referencingTfm, string expected)
{
// Skip Test if SDK is < 6.0.400
- var sdkVersion = SemanticVersion.Parse(TestContext.Current.ToolsetUnderTest.SdkVersion);
+ var sdkVersion = SemanticVersion.Parse(SdkTestContext.Current.ToolsetUnderTest.SdkVersion);
if (new SemanticVersion(sdkVersion.Major, sdkVersion.Minor, sdkVersion.Patch) < new SemanticVersion(6, 0, 400))
return; // MAUI was removed from earlier versions of the SDK
diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAFrameworkDependentApp.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAFrameworkDependentApp.cs
index 9cdd9af597fc..2dd41e68a955 100644
--- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAFrameworkDependentApp.cs
+++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAFrameworkDependentApp.cs
@@ -85,7 +85,7 @@ public void It_publishes_with_or_without_apphost(string useAppHost, string targe
new RunExeCommand(Log, Path.Combine(publishDirectory.FullName, appHostName))
.WithEnvironmentVariable(
Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)",
- Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath))
+ Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath))
.Execute()
.Should()
.Pass()
diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs
index b4de97ac65ba..90b267ccb339 100644
--- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs
+++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs
@@ -1157,12 +1157,12 @@ public static void Main()
case "AppRelative":
// Copy the host and runtime to the expected .NET root
expectedRoot = Path.Combine(publishDirectory, appRelativeDotNet);
- CopyDirectory(Path.Combine(TestContext.Current.ToolsetUnderTest.DotNetRoot, "host"), Path.Combine(expectedRoot, "host"));
- CopyDirectory(Path.Combine(TestContext.Current.ToolsetUnderTest.DotNetRoot, "shared", "Microsoft.NETCore.App"), Path.Combine(expectedRoot, "shared", "Microsoft.NETCore.App"));
+ CopyDirectory(Path.Combine(SdkTestContext.Current.ToolsetUnderTest.DotNetRoot, "host"), Path.Combine(expectedRoot, "host"));
+ CopyDirectory(Path.Combine(SdkTestContext.Current.ToolsetUnderTest.DotNetRoot, "shared", "Microsoft.NETCore.App"), Path.Combine(expectedRoot, "shared", "Microsoft.NETCore.App"));
break;
case "EnvironmentVariable":
// Set DOTNET_ROOT_ environment variable to the expected .NET root
- expectedRoot = TestContext.Current.ToolsetUnderTest.DotNetRoot;
+ expectedRoot = SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
runCommand = runCommand.WithEnvironmentVariable($"DOTNET_ROOT_{RuntimeInformation.OSArchitecture.ToString().ToUpperInvariant()}", expectedRoot);
break;
default:
diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs
index b4a98b2cab40..362783df5c68 100644
--- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs
+++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishTrimmedWindowsFormsAndWPFApps.cs
@@ -172,7 +172,7 @@ public void It_publishes_and_runs_windows_forms_app_with_no_wpf()
FileName = Path.Combine(publishDirectory, Path.GetFileName(testDir.Path) + ".exe")
};
- runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
+ runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
var result = runAppCommand.ToCommand()
.CaptureStdErr()
@@ -244,7 +244,7 @@ public void It_publishes_and_runs_wpf_app_with_no_winforms()
FileName = Path.Combine(publishDirectory, Path.GetFileName(testDir.Path) + ".exe")
};
- runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
+ runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
var result = runAppCommand.ToCommand()
.CaptureStdErr()
diff --git a/test/Microsoft.NET.Publish.Tests/PublishWebApp.cs b/test/Microsoft.NET.Publish.Tests/PublishWebApp.cs
index 37506e76c9c1..993f90619039 100644
--- a/test/Microsoft.NET.Publish.Tests/PublishWebApp.cs
+++ b/test/Microsoft.NET.Publish.Tests/PublishWebApp.cs
@@ -51,7 +51,7 @@ public void It_publishes_and_runs_self_contained_web_app()
FileName = Path.Combine(publishDirectory.FullName, testProject.Name + EnvironmentInfo.ExecutableExtension)
};
- runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
+ runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
var result = runAppCommand.ToCommand()
.CaptureStdErr()
diff --git a/test/Microsoft.NET.Publish.Tests/PublishWpfApp.cs b/test/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
index 7f30591530da..77f4e8e51baf 100644
--- a/test/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
+++ b/test/Microsoft.NET.Publish.Tests/PublishWpfApp.cs
@@ -59,7 +59,7 @@ public void It_publishes_and_runs_self_contained_wpf_app()
FileName = Path.Combine(publishDirectory, Path.GetFileName(testDir.Path) + ".exe")
};
- runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
+ runAppCommand.Environment["DOTNET_ROOT"] = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
var result = runAppCommand.ToCommand()
.CaptureStdErr()
diff --git a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToIgnoreObsoleteDotNetCliToolPackages.cs b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToIgnoreObsoleteDotNetCliToolPackages.cs
index ab05d1fa9e3a..3d4cfe29b6e7 100644
--- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToIgnoreObsoleteDotNetCliToolPackages.cs
+++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToIgnoreObsoleteDotNetCliToolPackages.cs
@@ -44,7 +44,7 @@ public void It_issues_warning_and_skips_restore_for_obsolete_DotNetCliToolRefere
.And
.HaveStdOutContaining($"warning NETSDK1059: The tool '{obsoletePackageId}' is now included in the .NET SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box).");
- string toolAssetsFilePath = Path.Combine(TestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant(), "99.99.99", toolProject.TargetFrameworks, "project.assets.json");
+ string toolAssetsFilePath = Path.Combine(SdkTestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant(), "99.99.99", toolProject.TargetFrameworks, "project.assets.json");
Assert.False(File.Exists(toolAssetsFilePath), "Tool assets path should not have been generated");
}
}
diff --git a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreDotNetCliToolReference.cs b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreDotNetCliToolReference.cs
index 144f755a021c..ec67078adc11 100644
--- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreDotNetCliToolReference.cs
+++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreDotNetCliToolReference.cs
@@ -50,8 +50,8 @@ public void It_can_restore_with_netcoreapp2_2()
TestAsset toolReferenceProjectInstance = _testAssetsManager.CreateTestProject(toolReferenceProject, identifier: toolReferenceProject.Name);
- DeleteFolder(Path.Combine(TestContext.Current.NuGetCachePath, toolProject.Name.ToLowerInvariant()));
- DeleteFolder(Path.Combine(TestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant()));
+ DeleteFolder(Path.Combine(SdkTestContext.Current.NuGetCachePath, toolProject.Name.ToLowerInvariant()));
+ DeleteFolder(Path.Combine(SdkTestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant()));
NuGetConfigWriter.Write(toolReferenceProjectInstance.TestRoot, nupkgPath);
RestoreCommand restoreCommand =
@@ -60,7 +60,7 @@ public void It_can_restore_with_netcoreapp2_2()
var restoreResult = restoreCommand
.Execute("/v:n");
- var assetsJsonPath = Path.Combine(TestContext.Current.NuGetCachePath,
+ var assetsJsonPath = Path.Combine(SdkTestContext.Current.NuGetCachePath,
".tools",
toolProject.Name.ToLowerInvariant(),
ProjectToolVersion,
diff --git a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs
index efb011d8ed0f..c581606a9ee4 100644
--- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs
+++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsUsingNuGetConfigProperties.cs
@@ -34,10 +34,10 @@ public void I_can_restore_a_project_with_implicit_msbuild_nuget_config(
string testProjectName = $"{projectPrefix}Fallback";
TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, frameworks);
- var packagesFolder = Path.Combine(TestContext.Current.TestExecutionDirectory, "packages", testProjectName);
+ var packagesFolder = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "packages", testProjectName);
var restoreCommand = testProjectTestAsset.GetRestoreCommand(Log, relativePath: testProjectName);
- restoreCommand.Execute($"/p:RestorePackagesPath={packagesFolder}", $"/p:_NugetFallbackFolder={TestContext.Current.NuGetFallbackFolder}").Should().Pass();
+ restoreCommand.Execute($"/p:RestorePackagesPath={packagesFolder}", $"/p:_NugetFallbackFolder={SdkTestContext.Current.NuGetFallbackFolder}").Should().Pass();
File.Exists(Path.Combine(
packagesFolder,
@@ -56,7 +56,7 @@ public void I_can_restore_with_implicit_msbuild_nuget_config(string frameworks,
TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, frameworks);
var restoreCommand = testProjectTestAsset.GetRestoreCommand(Log, relativePath: testProjectName);
- restoreCommand.Execute($"/p:_NugetFallbackFolder={TestContext.Current.NuGetFallbackFolder}").Should().Pass();
+ restoreCommand.Execute($"/p:_NugetFallbackFolder={SdkTestContext.Current.NuGetFallbackFolder}").Should().Pass();
}
[Theory]
@@ -71,7 +71,7 @@ public void I_can_disable_implicit_msbuild_nuget_config(string frameworks, strin
TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, frameworks);
var restoreCommand = testProjectTestAsset.GetRestoreCommand(Log, relativePath: testProjectName);
- restoreCommand.Execute($"/p:_NugetFallbackFolder={TestContext.Current.NuGetFallbackFolder}", "/p:DisableImplicitNuGetFallbackFolder=true").Should().Fail();
+ restoreCommand.Execute($"/p:_NugetFallbackFolder={SdkTestContext.Current.NuGetFallbackFolder}", "/p:DisableImplicitNuGetFallbackFolder=true").Should().Fail();
}
[Theory]
@@ -86,7 +86,7 @@ public void I_can_disable_1_x_implicit_msbuild_nuget_config(string frameworks, s
TestAsset testProjectTestAsset = CreateTestAsset(testProjectName, frameworks);
var restoreCommand = testProjectTestAsset.GetRestoreCommand(Log, relativePath: testProjectName);
- var executeResult = restoreCommand.Execute($"/p:_NugetFallbackFolder={TestContext.Current.NuGetFallbackFolder}", "/p:DisableImplicit1xNuGetFallbackFolder=true");
+ var executeResult = restoreCommand.Execute($"/p:_NugetFallbackFolder={SdkTestContext.Current.NuGetFallbackFolder}", "/p:DisableImplicit1xNuGetFallbackFolder=true");
if (shouldExecutePass)
{
@@ -132,7 +132,7 @@ private TestPackageReference CreatePackageInNuGetFallbackFolder(string testProje
new TestPackageReference(
projectInNuGetFallbackFolder.Name,
"1.0.0",
- TestContext.Current.NuGetFallbackFolder);
+ SdkTestContext.Current.NuGetFallbackFolder);
if (!projectInNuGetFallbackFolderPackageReference.NuGetPackageExists())
{
@@ -146,14 +146,14 @@ private TestPackageReference CreatePackageInNuGetFallbackFolder(string testProje
projectInNuGetFallbackFolder.Name);
var packagePackCommand =
new PackCommand(Log, dependencyProjectDirectory)
- .Execute($"/p:PackageOutputPath={TestContext.Current.NuGetFallbackFolder}").Should().Pass();
+ .Execute($"/p:PackageOutputPath={SdkTestContext.Current.NuGetFallbackFolder}").Should().Pass();
ExtractNupkg(
- TestContext.Current.NuGetFallbackFolder,
- Path.Combine(TestContext.Current.NuGetFallbackFolder, $"{projectInNuGetFallbackFolder.Name}.1.0.0.nupkg"));
+ SdkTestContext.Current.NuGetFallbackFolder,
+ Path.Combine(SdkTestContext.Current.NuGetFallbackFolder, $"{projectInNuGetFallbackFolder.Name}.1.0.0.nupkg"));
// make sure there is no package in cache
- DeleteFolder(Path.Combine(TestContext.Current.NuGetCachePath, projectInNuGetFallbackFolder.Name.ToLowerInvariant()));
+ DeleteFolder(Path.Combine(SdkTestContext.Current.NuGetCachePath, projectInNuGetFallbackFolder.Name.ToLowerInvariant()));
}
return projectInNuGetFallbackFolderPackageReference;
diff --git a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsWithPackageDowngrades.cs b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsWithPackageDowngrades.cs
index 1b0dbef8ea32..68c7b55214c4 100644
--- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsWithPackageDowngrades.cs
+++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToRestoreProjectsWithPackageDowngrades.cs
@@ -24,7 +24,7 @@ public void DowngradeWarningsAreErrorsByDefault()
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var packagesFolder = Path.Combine(TestContext.Current.TestExecutionDirectory, "packages", testProjectName);
+ var packagesFolder = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "packages", testProjectName);
var restoreCommand = testAsset.GetRestoreCommand(Log, relativePath: testProjectName);
restoreCommand
@@ -55,7 +55,7 @@ public void ItIsPossibleToTurnOffDowngradeWarningsAsErrors()
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var packagesFolder = Path.Combine(TestContext.Current.TestExecutionDirectory, "packages", testProjectName);
+ var packagesFolder = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "packages", testProjectName);
var restoreCommand = testAsset.GetRestoreCommand(Log, relativePath: testProjectName);
restoreCommand
diff --git a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToUseFrameworkRoslyn.cs b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToUseFrameworkRoslyn.cs
index e5bd7e1fec70..e3feab92935e 100644
--- a/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToUseFrameworkRoslyn.cs
+++ b/test/Microsoft.NET.Restore.Tests/GivenThatWeWantToUseFrameworkRoslyn.cs
@@ -26,7 +26,7 @@ public void It_downloads_Microsoft_Net_Compilers_Toolset_Framework_when_requeste
var testAsset = _testAssetsManager
.CreateTestProject(project);
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
var customPackagesDir = Path.Combine(testAsset.Path, "nuget-packages");
@@ -65,7 +65,7 @@ public void It_downloads_Microsoft_Net_Compilers_Toolset_Framework_when_MSBuild_
var testAsset = _testAssetsManager
.CreateTestProject(project);
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
var customPackagesDir = Path.Combine(testAsset.Path, "nuget-packages");
@@ -153,7 +153,7 @@ public void It_throws_a_warning_when_NuGetPackageRoot_is_empty()
var testAsset = _testAssetsManager
.CreateTestProject(project);
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
var customPackagesDir = Path.Combine(testAsset.Path, "nuget-packages");
@@ -176,7 +176,7 @@ public void It_does_not_throw_a_warning_when_NuGetPackageRoot_is_empty_in_wpftmp
.CopyTestAsset("DesktopWpf")
.WithSource();
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
var buildCommand = new BuildCommand(testAsset, relativePathToProject: "FxWpf")
{
diff --git a/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorLegacyIntegrationTest60.cs b/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorLegacyIntegrationTest60.cs
index 59e6d691fbbb..cbdf2ceb1eb2 100644
--- a/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorLegacyIntegrationTest60.cs
+++ b/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorLegacyIntegrationTest60.cs
@@ -14,7 +14,7 @@ public class BlazorLegacyIntegrationTest60(ITestOutputHelper log)
string.Join('.', "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");
protected override string ComputeBaselineFolder() =>
- Path.Combine(TestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");
+ Path.Combine(SdkTestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");
[CoreMSBuildOnlyFact]
public void Build60Hosted_Works()
diff --git a/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs b/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs
index 6a21d104b8fd..1afe686bdf97 100644
--- a/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs
+++ b/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmBaselineTests.cs
@@ -10,6 +10,6 @@ public class BlazorWasmBaselineTests(ITestOutputHelper log, bool generateBaselin
protected override string EmbeddedResourcePrefix => string.Join('.', "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");
protected override string ComputeBaselineFolder() =>
- Path.Combine(TestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");
+ Path.Combine(SdkTestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");
}
}
diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AspNetSdkBaselineTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AspNetSdkBaselineTest.cs
index db1687fe8d17..74e16f6b04bd 100644
--- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AspNetSdkBaselineTest.cs
+++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AspNetSdkBaselineTest.cs
@@ -68,7 +68,7 @@ public AspNetSdkBaselineTest(ITestOutputHelper log, bool generateBaselines) : th
private static StaticWebAssetsBaselineFactory CreateBaselineFactory() => StaticWebAssetsBaselineFactory.Instance;
protected virtual string ComputeBaselineFolder() =>
- Path.Combine(TestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.StaticWebAssets.Tests", "StaticWebAssetsBaselines");
+ Path.Combine(SdkTestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.StaticWebAssets.Tests", "StaticWebAssetsBaselines");
protected virtual string EmbeddedResourcePrefix => string.Join('.', "Microsoft.NET.Sdk.StaticWebAssets.Tests", "StaticWebAssetsBaselines");
@@ -143,7 +143,7 @@ protected void AssertBuildAssets(
.Distinct()
.OrderBy(f => f, StringComparer.Ordinal)
.ToArray(),
- GetNuGetCachePath() ?? TestContext.Current.NuGetCachePath,
+ GetNuGetCachePath() ?? SdkTestContext.Current.NuGetCachePath,
ProjectDirectory.TestRoot,
intermediateOutputPath,
outputFolder).ToArray();
@@ -239,7 +239,7 @@ [.. wwwRootFiles
.Concat(copyToPublishDirectoryFiles)
.Distinct()
.OrderBy(f => f, StringComparer.Ordinal)],
- GetNuGetCachePath() ?? TestContext.Current.NuGetCachePath,
+ GetNuGetCachePath() ?? SdkTestContext.Current.NuGetCachePath,
ProjectDirectory.TestRoot,
intermediateOutputPath,
publishFolder);
@@ -287,14 +287,14 @@ internal void AssertManifest(
_baselineFactory.ToTemplate(
actual,
ProjectDirectory.Path,
- GetNuGetCachePath() ?? TestContext.Current.NuGetCachePath,
+ GetNuGetCachePath() ?? SdkTestContext.Current.NuGetCachePath,
runtimeIdentifier);
_comparer.AssertManifest(expected, actual);
}
else
{
- var template = Templatize(actual, ProjectDirectory.Path, GetNuGetCachePath() ?? TestContext.Current.NuGetCachePath, runtimeIdentifier);
+ var template = Templatize(actual, ProjectDirectory.Path, GetNuGetCachePath() ?? SdkTestContext.Current.NuGetCachePath, runtimeIdentifier);
if (!Directory.Exists(Path.Combine(BaselinesFolder)))
{
Directory.CreateDirectory(Path.Combine(BaselinesFolder));
diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/IsolatedNuGetPackageFolderAspNetSdkBaselineTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/IsolatedNuGetPackageFolderAspNetSdkBaselineTest.cs
index 7a16a96a57a5..528f4606a602 100644
--- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/IsolatedNuGetPackageFolderAspNetSdkBaselineTest.cs
+++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/IsolatedNuGetPackageFolderAspNetSdkBaselineTest.cs
@@ -12,7 +12,7 @@ public class IsolatedNuGetPackageFolderAspNetSdkBaselineTest : AspNetSdkBaseline
public IsolatedNuGetPackageFolderAspNetSdkBaselineTest(ITestOutputHelper log, string restoreNugetPackagePath) : base(log)
{
- _cachePath = Path.GetFullPath(Path.Combine(TestContext.Current.TestExecutionDirectory, Shorten(restoreNugetPackagePath)));
+ _cachePath = Path.GetFullPath(Path.Combine(SdkTestContext.Current.TestExecutionDirectory, Shorten(restoreNugetPackagePath)));
}
private static string Shorten(string restoreNugetPackagePath) =>
diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/DiscoverPrecompressedAssetsTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/DiscoverPrecompressedAssetsTest.cs
index 27d7baae60f0..d9b5e6cc44d6 100644
--- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/DiscoverPrecompressedAssetsTest.cs
+++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/DiscoverPrecompressedAssetsTest.cs
@@ -19,7 +19,7 @@ public class DiscoverPrecompressedAssetsTest
public DiscoverPrecompressedAssetsTest()
{
- OutputBasePath = Path.Combine(TestContext.Current.TestExecutionDirectory, nameof(ResolveCompressedAssetsTest));
+ OutputBasePath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, nameof(ResolveCompressedAssetsTest));
ItemSpec = Path.Combine(OutputBasePath, Guid.NewGuid().ToString("N") + ".tmp");
OriginalItemSpec = Path.Combine(OutputBasePath, Guid.NewGuid().ToString("N") + ".tmp");
}
diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs
index ab2ed782df44..63899799ee8e 100644
--- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs
+++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs
@@ -13,8 +13,8 @@ public class GenerateStaticWebAssetsManifestTest
{
public GenerateStaticWebAssetsManifestTest()
{
- Directory.CreateDirectory(Path.Combine(TestContext.Current.TestExecutionDirectory, nameof(GenerateStaticWebAssetsManifestTest)));
- TempFilePath = Path.Combine(TestContext.Current.TestExecutionDirectory, nameof(GenerateStaticWebAssetsManifestTest), Guid.NewGuid().ToString("N") + ".json");
+ Directory.CreateDirectory(Path.Combine(SdkTestContext.Current.TestExecutionDirectory, nameof(GenerateStaticWebAssetsManifestTest)));
+ TempFilePath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, nameof(GenerateStaticWebAssetsManifestTest), Guid.NewGuid().ToString("N") + ".json");
}
public string TempFilePath { get; }
diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs
index 429752e69c8c..0ea35e74fd2c 100644
--- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs
+++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileTest.cs
@@ -14,8 +14,8 @@ public class ReadStaticWebAssetsManifestFileTest
{
public ReadStaticWebAssetsManifestFileTest()
{
- Directory.CreateDirectory(Path.Combine(TestContext.Current.TestExecutionDirectory, nameof(ReadStaticWebAssetsManifestFileTest)));
- TempFilePath = Path.Combine(TestContext.Current.TestExecutionDirectory, nameof(ReadStaticWebAssetsManifestFileTest), Guid.NewGuid().ToString("N") + ".json");
+ Directory.CreateDirectory(Path.Combine(SdkTestContext.Current.TestExecutionDirectory, nameof(ReadStaticWebAssetsManifestFileTest)));
+ TempFilePath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, nameof(ReadStaticWebAssetsManifestFileTest), Guid.NewGuid().ToString("N") + ".json");
}
public string TempFilePath { get; }
diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs
index 5098c8ac0738..358f746c3de0 100644
--- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs
+++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs
@@ -23,7 +23,7 @@ public class ResolveCompressedAssetsTest
public ResolveCompressedAssetsTest()
{
- OutputBasePath = Path.Combine(TestContext.Current.TestExecutionDirectory, nameof(ResolveCompressedAssetsTest));
+ OutputBasePath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, nameof(ResolveCompressedAssetsTest));
ItemSpec = Path.Combine(OutputBasePath, Guid.NewGuid().ToString("N") + ".tmp");
OriginalItemSpec = Path.Combine(OutputBasePath, Guid.NewGuid().ToString("N") + ".tmp");
}
diff --git a/test/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs b/test/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs
index 8dce2302d652..54be8c4e866b 100644
--- a/test/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs
+++ b/test/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs
@@ -82,7 +82,7 @@ public void TestGetPackGroups()
public void TestGetManifestFeatureBands()
{
var manifestProvider = CreateManifestProvider();
- var workloadResolver = WorkloadResolver.CreateForTests(manifestProvider, TestContext.Current.ToolsetUnderTest.DotNetRoot);
+ var workloadResolver = WorkloadResolver.CreateForTests(manifestProvider, SdkTestContext.Current.ToolsetUnderTest.DotNetRoot);
foreach (var manifestInfo in workloadResolver.GetInstalledManifests())
{
@@ -93,7 +93,7 @@ public void TestGetManifestFeatureBands()
SdkDirectoryWorkloadManifestProvider CreateManifestProvider()
{
- return new(TestContext.Current.ToolsetUnderTest.DotNetRoot, TestContext.Current.ToolsetUnderTest.SdkVersion, userProfileDir: null, globalJsonPath: null);
+ return new(SdkTestContext.Current.ToolsetUnderTest.DotNetRoot, SdkTestContext.Current.ToolsetUnderTest.SdkVersion, userProfileDir: null, globalJsonPath: null);
}
public IEnumerable GetManifests(SdkDirectoryWorkloadManifestProvider? manifestProvider = null)
@@ -149,7 +149,7 @@ List GetPackGroups()
var manifestProvider = CreateManifestProvider();
var manifests = GetManifests(manifestProvider);
- var workloadResolver = WorkloadResolver.CreateForTests(manifestProvider, TestContext.Current.ToolsetUnderTest.DotNetRoot);
+ var workloadResolver = WorkloadResolver.CreateForTests(manifestProvider, SdkTestContext.Current.ToolsetUnderTest.DotNetRoot);
foreach (var manifest in manifests)
{
diff --git a/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs b/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs
index ce3f01f6c99c..a428871fdfc7 100644
--- a/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs
+++ b/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs
@@ -59,7 +59,7 @@ public static AndConstraint BeVisuallyEquivalentToIfNotLocaliz
params object[] becauseArgs
)
{
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
return BeVisuallyEquivalentTo(assertions, expected, because, becauseArgs);
}
@@ -75,7 +75,7 @@ public static AndConstraint ContainVisuallySameFragment(this S
public static AndConstraint ContainVisuallySameFragmentIfNotLocalized(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs)
{
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
return ContainVisuallySameFragment(assertions, expected, because, becauseArgs);
}
diff --git a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyFactAttribute.cs b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyFactAttribute.cs
index d7f9a4994525..ee3b0b7fac1b 100644
--- a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyFactAttribute.cs
+++ b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyFactAttribute.cs
@@ -7,7 +7,7 @@ public class CoreMSBuildAndWindowsOnlyFactAttribute : FactAttribute
{
public CoreMSBuildAndWindowsOnlyFactAttribute()
{
- if (TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild || !RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (SdkTestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild || !RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Skip = "This test requires Core MSBuild and Windows to run";
}
diff --git a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyTheoryAttribute.cs b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyTheoryAttribute.cs
index ecf9e48bf808..033d688f05a6 100644
--- a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyTheoryAttribute.cs
+++ b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyTheoryAttribute.cs
@@ -7,7 +7,7 @@ public class CoreMSBuildAndWindowsOnlyTheoryAttribute : TheoryAttribute
{
public CoreMSBuildAndWindowsOnlyTheoryAttribute()
{
- if (TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild || !RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (SdkTestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild || !RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Skip = "This test requires Core MSBuild and Windows to run";
}
diff --git a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyFactAttribute.cs b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyFactAttribute.cs
index c09394700ae8..cd9c7efd0472 100644
--- a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyFactAttribute.cs
+++ b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyFactAttribute.cs
@@ -7,7 +7,7 @@ public class CoreMSBuildOnlyFactAttribute : FactAttribute
{
public CoreMSBuildOnlyFactAttribute()
{
- if (TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
+ if (SdkTestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
{
Skip = "This test requires Core MSBuild to run";
}
diff --git a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyTheoryAttribute.cs b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyTheoryAttribute.cs
index a756d6e95a88..729d2e6848ba 100644
--- a/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyTheoryAttribute.cs
+++ b/test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyTheoryAttribute.cs
@@ -7,7 +7,7 @@ public class CoreMSBuildOnlyTheoryAttribute : TheoryAttribute
{
public CoreMSBuildOnlyTheoryAttribute()
{
- if (TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
+ if (SdkTestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
{
Skip = "This test requires Core MSBuild to run";
}
diff --git a/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyFactAttribute.cs b/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyFactAttribute.cs
index b7a4c9961925..e9ce263c7325 100644
--- a/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyFactAttribute.cs
+++ b/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyFactAttribute.cs
@@ -7,7 +7,7 @@ public class FullMSBuildOnlyFactAttribute : FactAttribute
{
public FullMSBuildOnlyFactAttribute()
{
- if (!TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
+ if (!SdkTestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
{
Skip = "This test requires Full MSBuild to run";
}
diff --git a/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyTheoryAttribute.cs b/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyTheoryAttribute.cs
index 09abd77f8dfd..e1f35bf516bf 100644
--- a/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyTheoryAttribute.cs
+++ b/test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyTheoryAttribute.cs
@@ -7,7 +7,7 @@ public class FullMSBuildOnlyTheoryAttribute : TheoryAttribute
{
public FullMSBuildOnlyTheoryAttribute()
{
- if (!TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
+ if (!SdkTestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
{
Skip = "This test requires Full MSBuild to run";
}
diff --git a/test/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs b/test/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs
index 86bc24729b77..b09480505f59 100644
--- a/test/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs
+++ b/test/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs
@@ -17,9 +17,9 @@ public RequiresMSBuildVersionTheoryAttribute(string version)
public static void CheckForRequiredMSBuildVersion(FactAttribute attribute, string version)
{
- if (!Version.TryParse(TestContext.Current.ToolsetUnderTest.MSBuildVersion, out Version? msbuildVersion))
+ if (!Version.TryParse(SdkTestContext.Current.ToolsetUnderTest.MSBuildVersion, out Version? msbuildVersion))
{
- attribute.Skip = $"Failed to determine the version of MSBuild ({TestContext.Current.ToolsetUnderTest.MSBuildVersion}).";
+ attribute.Skip = $"Failed to determine the version of MSBuild ({SdkTestContext.Current.ToolsetUnderTest.MSBuildVersion}).";
return;
}
if (!Version.TryParse(version, out Version? requiredVersion))
@@ -29,7 +29,7 @@ public static void CheckForRequiredMSBuildVersion(FactAttribute attribute, strin
}
if (requiredVersion > msbuildVersion)
{
- attribute.Skip = $"This test requires MSBuild version {version} to run (using {TestContext.Current.ToolsetUnderTest.MSBuildVersion}).";
+ attribute.Skip = $"This test requires MSBuild version {version} to run (using {SdkTestContext.Current.ToolsetUnderTest.MSBuildVersion}).";
}
}
}
diff --git a/test/Microsoft.NET.TestFramework/Commands/DotnetCommand.cs b/test/Microsoft.NET.TestFramework/Commands/DotnetCommand.cs
index 8122ca293148..fa1caecf0605 100644
--- a/test/Microsoft.NET.TestFramework/Commands/DotnetCommand.cs
+++ b/test/Microsoft.NET.TestFramework/Commands/DotnetCommand.cs
@@ -14,11 +14,11 @@ protected override SdkCommandSpec CreateCommand(IEnumerable args)
{
var sdkCommandSpec = new SdkCommandSpec()
{
- FileName = TestContext.Current.ToolsetUnderTest.DotNetHostPath,
+ FileName = SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath,
Arguments = args.ToList(),
WorkingDirectory = WorkingDirectory
};
- TestContext.Current.AddTestEnvironmentVariables(sdkCommandSpec.Environment);
+ SdkTestContext.Current.AddTestEnvironmentVariables(sdkCommandSpec.Environment);
return sdkCommandSpec;
}
}
diff --git a/test/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs b/test/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs
index ebe0819aa7e0..4faaceb962c7 100644
--- a/test/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs
+++ b/test/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs
@@ -135,7 +135,7 @@ protected override SdkCommandSpec CreateCommand(IEnumerable args)
var outputDirectory = GetValuesOutputDirectory(_targetFramework);
outputDirectory.Create();
- return TestContext.Current.ToolsetUnderTest.CreateCommandForTarget(TargetName, newArgs);
+ return SdkTestContext.Current.ToolsetUnderTest.CreateCommandForTarget(TargetName, newArgs);
}
public List GetValues()
diff --git a/test/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs b/test/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs
index 3c3c6390cd11..c7130b4366b6 100644
--- a/test/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs
+++ b/test/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs
@@ -165,7 +165,7 @@ protected override SdkCommandSpec CreateCommand(IEnumerable args)
var newArgs = args.ToList();
newArgs.Insert(0, FullPathProjectFile);
- return TestContext.Current.ToolsetUnderTest.CreateCommandForTarget(Target, newArgs);
+ return SdkTestContext.Current.ToolsetUnderTest.CreateCommandForTarget(Target, newArgs);
}
}
}
diff --git a/test/Microsoft.NET.TestFramework/Commands/MSBuildVersionCommand.cs b/test/Microsoft.NET.TestFramework/Commands/MSBuildVersionCommand.cs
index 178daab62b70..288147c4c55b 100644
--- a/test/Microsoft.NET.TestFramework/Commands/MSBuildVersionCommand.cs
+++ b/test/Microsoft.NET.TestFramework/Commands/MSBuildVersionCommand.cs
@@ -9,11 +9,11 @@ public MSBuildVersionCommand(ITestOutputHelper log) : base(log) { }
protected override SdkCommandSpec CreateCommand(IEnumerable args)
{
- if (TestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
+ if (SdkTestContext.Current.ToolsetUnderTest.ShouldUseFullFrameworkMSBuild)
{
return new SdkCommandSpec()
{
- FileName = TestContext.Current.ToolsetUnderTest.FullFrameworkMSBuildPath,
+ FileName = SdkTestContext.Current.ToolsetUnderTest.FullFrameworkMSBuildPath,
Arguments = { "-version" },
WorkingDirectory = WorkingDirectory
};
@@ -22,7 +22,7 @@ protected override SdkCommandSpec CreateCommand(IEnumerable args)
{
return new SdkCommandSpec()
{
- FileName = TestContext.Current.ToolsetUnderTest.DotNetHostPath,
+ FileName = SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath,
Arguments = { "msbuild", "-version" },
WorkingDirectory = WorkingDirectory
};
diff --git a/test/Microsoft.NET.TestFramework/Commands/NuGetExeRestoreCommand.cs b/test/Microsoft.NET.TestFramework/Commands/NuGetExeRestoreCommand.cs
index 165953dedc4f..b2def7999de2 100644
--- a/test/Microsoft.NET.TestFramework/Commands/NuGetExeRestoreCommand.cs
+++ b/test/Microsoft.NET.TestFramework/Commands/NuGetExeRestoreCommand.cs
@@ -24,12 +24,12 @@ public NuGetExeRestoreCommand(ITestOutputHelper log, string projectRootPath, str
protected override SdkCommandSpec CreateCommand(IEnumerable args)
{
- if (string.IsNullOrEmpty(TestContext.Current.NuGetExePath))
+ if (string.IsNullOrEmpty(SdkTestContext.Current.NuGetExePath))
{
throw new InvalidOperationException("Path to nuget.exe not set");
}
- var nugetExePath = TestContext.Current.NuGetExePath;
+ var nugetExePath = SdkTestContext.Current.NuGetExePath;
if (!string.IsNullOrEmpty(NuGetExeVersion))
{
nugetExePath = Path.Combine(Path.GetDirectoryName(nugetExePath) ?? string.Empty, NuGetExeVersion, "nuget.exe");
@@ -66,12 +66,12 @@ async Task DownloadNuGetAsync()
"restore",
FullPathProjectFile,
"-PackagesDirectory",
- PackagesDirectory ?? TestContext.Current.NuGetCachePath ?? string.Empty,
+ PackagesDirectory ?? SdkTestContext.Current.NuGetCachePath ?? string.Empty,
.. args
]
};
- TestContext.Current.AddTestEnvironmentVariables(ret.Environment);
+ SdkTestContext.Current.AddTestEnvironmentVariables(ret.Environment);
return ret;
}
diff --git a/test/Microsoft.NET.TestFramework/Commands/RunExeCommand.cs b/test/Microsoft.NET.TestFramework/Commands/RunExeCommand.cs
index 97751154a6a4..08e6a1ea7614 100644
--- a/test/Microsoft.NET.TestFramework/Commands/RunExeCommand.cs
+++ b/test/Microsoft.NET.TestFramework/Commands/RunExeCommand.cs
@@ -26,7 +26,7 @@ protected override SdkCommandSpec CreateCommand(IEnumerable args)
Arguments = args.ToList(),
WorkingDirectory = WorkingDirectory,
};
- TestContext.Current.AddTestEnvironmentVariables(sdkCommandSpec.Environment);
+ SdkTestContext.Current.AddTestEnvironmentVariables(sdkCommandSpec.Environment);
return sdkCommandSpec;
}
}
diff --git a/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj b/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj
index ba14c1483ba4..8861cf1e756e 100644
--- a/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj
+++ b/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj
@@ -37,6 +37,10 @@
<_Parameter1>AspirePackageVersion
<_Parameter2>$(AspirePackageVersion)
+
+ <_Parameter1>MicrosoftExtensionsServiceDiscoveryPackageVersion
+ <_Parameter2>$(MicrosoftExtensionsServiceDiscoveryPackageVersion)
+
diff --git a/test/Microsoft.NET.TestFramework/SdkTest.cs b/test/Microsoft.NET.TestFramework/SdkTest.cs
index c508ec7ba4a8..d111a5ab0ce1 100644
--- a/test/Microsoft.NET.TestFramework/SdkTest.cs
+++ b/test/Microsoft.NET.TestFramework/SdkTest.cs
@@ -7,7 +7,7 @@ public abstract class SdkTest
{
protected TestAssetsManager _testAssetsManager;
- protected bool? UsingFullFrameworkMSBuild => TestContext.Current.ToolsetUnderTest?.ShouldUseFullFrameworkMSBuild;
+ protected bool? UsingFullFrameworkMSBuild => SdkTestContext.Current.ToolsetUnderTest?.ShouldUseFullFrameworkMSBuild;
protected ITestOutputHelper Log { get; }
diff --git a/test/Microsoft.NET.TestFramework/TestContext.cs b/test/Microsoft.NET.TestFramework/SdkTestContext.cs
similarity index 98%
rename from test/Microsoft.NET.TestFramework/TestContext.cs
rename to test/Microsoft.NET.TestFramework/SdkTestContext.cs
index 136808001333..55bb6d31f9d7 100644
--- a/test/Microsoft.NET.TestFramework/TestContext.cs
+++ b/test/Microsoft.NET.TestFramework/SdkTestContext.cs
@@ -6,7 +6,7 @@
namespace Microsoft.NET.TestFramework
{
- public class TestContext
+ public class SdkTestContext
{
// Generally the folder the test DLL is in
private string? _testExecutionDirectory;
@@ -77,9 +77,9 @@ public ToolsetInfo ToolsetUnderTest
}
}
- private static TestContext? _current;
+ private static SdkTestContext? _current;
- public static TestContext Current
+ public static SdkTestContext Current
{
get
{
@@ -101,7 +101,7 @@ public static TestContext Current
public static string GetRuntimeGraphFilePath()
{
- string dotnetRoot = TestContext.Current.ToolsetUnderTest.DotNetRoot;
+ string dotnetRoot = SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
DirectoryInfo sdksDir = new(Path.Combine(dotnetRoot, "sdk"));
@@ -147,7 +147,7 @@ public static void Initialize(TestCommandLine commandLine)
// one running the tests, it won't interfere
Environment.SetEnvironmentVariable("MSBuildSdksPath", null);
- TestContext testContext = new();
+ SdkTestContext testContext = new();
bool runAsTool = false;
if (Directory.Exists(Path.Combine(AppContext.BaseDirectory, "TestAssets")))
diff --git a/test/Microsoft.NET.TestFramework/TestAssetsManager.cs b/test/Microsoft.NET.TestFramework/TestAssetsManager.cs
index 67bf81b1eca8..9db89e7e4c78 100644
--- a/test/Microsoft.NET.TestFramework/TestAssetsManager.cs
+++ b/test/Microsoft.NET.TestFramework/TestAssetsManager.cs
@@ -16,7 +16,7 @@ public class TestAssetsManager
public TestAssetsManager(ITestOutputHelper log)
{
- var testAssetsDirectory = TestContext.Current.TestAssetsDirectory;
+ var testAssetsDirectory = SdkTestContext.Current.TestAssetsDirectory;
Log = log;
if (!Directory.Exists(testAssetsDirectory))
@@ -46,7 +46,7 @@ public TestAsset CopyTestAsset(
testDestinationDirectory ??= GetTestDestinationDirectoryPath(testProjectName, callingMethod + "_" + fileName, identifier, allowCopyIfPresent);
TestDestinationDirectories.Add(testDestinationDirectory);
- var testAsset = new TestAsset(testProjectDirectory, testDestinationDirectory, TestContext.Current.SdkVersion, Log);
+ var testAsset = new TestAsset(testProjectDirectory, testDestinationDirectory, SdkTestContext.Current.SdkVersion, Log);
return testAsset;
}
@@ -125,7 +125,7 @@ private TestAsset CreateTestProjectsInDirectory(
IEnumerable testProjects,
string testDestinationDirectory)
{
- var testAsset = new TestAsset(testDestinationDirectory, TestContext.Current.SdkVersion, Log);
+ var testAsset = new TestAsset(testDestinationDirectory, SdkTestContext.Current.SdkVersion, Log);
Stack projectStack = new(testProjects);
HashSet createdProjects = new();
@@ -151,7 +151,7 @@ private TestAsset CreateTestProjectsInDirectory(
public TestDirectory CreateTestDirectory([CallerMemberName] string? testName = null, string? identifier = null, string? baseDirectory = null)
{
string dir = GetTestDestinationDirectoryPath(testName, testName, identifier ?? string.Empty, baseDirectory: baseDirectory);
- return new TestDirectory(dir, TestContext.Current.SdkVersion);
+ return new TestDirectory(dir, SdkTestContext.Current.SdkVersion);
}
public string GetAndValidateTestProjectDirectory(string testProjectName, string testAssetSubdirectory = "")
@@ -177,7 +177,7 @@ public static string GetTestDestinationDirectoryPath(
bool allowCopyIfPresent = false,
string? baseDirectory = null)
{
- baseDirectory ??= TestContext.Current.TestExecutionDirectory;
+ baseDirectory ??= SdkTestContext.Current.TestExecutionDirectory;
var directoryName = new StringBuilder(callingMethodAndFileName).Append(identifier);
if (testProjectName != callingMethodAndFileName)
diff --git a/test/Microsoft.NET.TestFramework/TestCommandLine.cs b/test/Microsoft.NET.TestFramework/TestCommandLine.cs
index ab94559bb7aa..e192bba3ab95 100644
--- a/test/Microsoft.NET.TestFramework/TestCommandLine.cs
+++ b/test/Microsoft.NET.TestFramework/TestCommandLine.cs
@@ -288,7 +288,7 @@ public static TestCommandLine HandleCommandLine(string[] args)
if (!commandLine.ShouldShowHelp)
{
- TestContext.Initialize(commandLine);
+ SdkTestContext.Initialize(commandLine);
}
return commandLine;
diff --git a/test/Microsoft.NET.TestFramework/TestDirectory.cs b/test/Microsoft.NET.TestFramework/TestDirectory.cs
index 5ec95f511bcb..113365c43b4f 100644
--- a/test/Microsoft.NET.TestFramework/TestDirectory.cs
+++ b/test/Microsoft.NET.TestFramework/TestDirectory.cs
@@ -19,7 +19,7 @@ internal TestDirectory(string path, string? sdkVersion)
public static TestDirectory Create(string path)
{
- return new TestDirectory(path, TestContext.Current.SdkVersion);
+ return new TestDirectory(path, SdkTestContext.Current.SdkVersion);
}
public string Path { get; private set; }
@@ -50,7 +50,7 @@ private static void EnsureExistsAndEmpty(string path, string? sdkVersion)
Directory.CreateDirectory(path);
- TestContext.WriteGlobalJson(path, sdkVersion);
+ SdkTestContext.WriteGlobalJson(path, sdkVersion);
}
}
}
diff --git a/test/Microsoft.NET.TestFramework/ToolsetInfo.cs b/test/Microsoft.NET.TestFramework/ToolsetInfo.cs
index 3ff247a086e0..b2444ed37003 100644
--- a/test/Microsoft.NET.TestFramework/ToolsetInfo.cs
+++ b/test/Microsoft.NET.TestFramework/ToolsetInfo.cs
@@ -93,7 +93,7 @@ private void InitSdkVersion()
var logger = new StringTestLogger();
var command = new DotnetCommand(logger, "--version")
{
- WorkingDirectory = TestContext.Current.TestExecutionDirectory
+ WorkingDirectory = SdkTestContext.Current.TestExecutionDirectory
};
var result = command.Execute();
@@ -116,7 +116,7 @@ private void InitMSBuildVersion()
var logger = new StringTestLogger();
var command = new MSBuildVersionCommand(logger)
{
- WorkingDirectory = TestContext.Current.TestExecutionDirectory
+ WorkingDirectory = SdkTestContext.Current.TestExecutionDirectory
};
var result = command.Execute();
@@ -242,7 +242,7 @@ private SdkCommandSpec CreateCommand(params string[] args)
ret.Arguments = newArgs;
}
- TestContext.Current.AddTestEnvironmentVariables(ret.Environment);
+ SdkTestContext.Current.AddTestEnvironmentVariables(ret.Environment);
return ret;
}
diff --git a/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs b/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs
index 63dbc7a4a518..a797e1b38b7e 100644
--- a/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs
+++ b/test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProjectWithPackagedShim.cs
@@ -139,7 +139,7 @@ public void It_contains_shim(bool multiTarget, string targetFramework)
[InlineData(false, ToolsetInfo.CurrentTargetFramework)]
public void It_uses_customized_PackagedShimOutputRootDirectory(bool multiTarget, string targetFramework)
{
- string shimoutputPath = Path.Combine(TestContext.Current.TestExecutionDirectory, "shimoutput");
+ string shimoutputPath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "shimoutput");
TestAsset helloWorldAsset = _testAssetsManager
.CopyTestAsset("PortableTool", "PackagedShimOutputRootDirectory" + multiTarget.ToString(), identifier: multiTarget.ToString() + targetFramework)
.WithSource()
diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/BaseTest.cs b/test/Microsoft.TemplateEngine.Cli.UnitTests/BaseTest.cs
index 43e5eb1f9e1d..f7bbac4fb410 100644
--- a/test/Microsoft.TemplateEngine.Cli.UnitTests/BaseTest.cs
+++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/BaseTest.cs
@@ -8,7 +8,7 @@ public abstract class BaseTest
///
/// Gets a path to the folder with dotnet new test assets.
///
- public static string DotnetNewTestAssets { get; } = VerifyExists(Path.Combine(TestContext.Current.TestAssetsDirectory, "TestPackages", "dotnet-new"));
+ public static string DotnetNewTestAssets { get; } = VerifyExists(Path.Combine(SdkTestContext.Current.TestAssetsDirectory, "TestPackages", "dotnet-new"));
///
/// Gets a path to the folder with dotnet new test NuGet template packages.
@@ -55,7 +55,7 @@ private static string VerifyExists(string folder)
private static string GetAndVerifyRepoRoot()
{
- string repoRoot = Path.GetFullPath(Path.Combine(TestContext.Current.TestAssetsDirectory, "..", ".."));
+ string repoRoot = Path.GetFullPath(Path.Combine(SdkTestContext.Current.TestAssetsDirectory, "..", ".."));
if (!Directory.Exists(repoRoot))
{
Assert.Fail($"The repo root cannot be evaluated.");
diff --git a/test/TestAssets/TestProjects/WatchApp60/Program.cs b/test/TestAssets/TestProjects/WatchApp60/Program.cs
deleted file mode 100644
index 5e164b48f9d7..000000000000
--- a/test/TestAssets/TestProjects/WatchApp60/Program.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Threading;
-
-namespace ConsoleApplication
-{
- public class Program
- {
- public static void Main(string[] args)
- {
- Console.WriteLine("Started");
- // Process ID is insufficient because PID's may be reused.
- Console.WriteLine($"Process identifier = {Process.GetCurrentProcess().Id}, {Guid.NewGuid()}");
- if (args.Length > 0 && args[0] == "--no-exit")
- {
- Thread.Sleep(Timeout.Infinite);
- }
- Console.WriteLine("Exiting");
- }
- }
-}
diff --git a/test/TestAssets/TestProjects/WatchApp60/WatchApp60.csproj b/test/TestAssets/TestProjects/WatchApp60/WatchApp60.csproj
deleted file mode 100644
index f9ba9848ae6d..000000000000
--- a/test/TestAssets/TestProjects/WatchApp60/WatchApp60.csproj
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- net6.0
- exe
-
-
-
diff --git a/test/TestAssets/TestProjects/WatchAspire/WatchAspire.ServiceDefaults/WatchAspire.ServiceDefaults.csproj b/test/TestAssets/TestProjects/WatchAspire/WatchAspire.ServiceDefaults/WatchAspire.ServiceDefaults.csproj
index ebd47bc72991..70884e7485de 100644
--- a/test/TestAssets/TestProjects/WatchAspire/WatchAspire.ServiceDefaults/WatchAspire.ServiceDefaults.csproj
+++ b/test/TestAssets/TestProjects/WatchAspire/WatchAspire.ServiceDefaults/WatchAspire.ServiceDefaults.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/test/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs b/test/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs
index 56374a60d574..d972d3c34db5 100644
--- a/test/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs
+++ b/test/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs
@@ -140,11 +140,11 @@ protected void DeployStage2Sdk()
var installedSdkFolder = $@"c:\Program Files\dotnet\sdk\{existingVersionToOverwrite}";
- Log.WriteLine($"Deploying SDK from {TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest} to {installedSdkFolder} on VM.");
+ Log.WriteLine($"Deploying SDK from {SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest} to {installedSdkFolder} on VM.");
// TODO: It would be nice if the description included the date/time of the SDK build, to distinguish different snapshots
VM.CreateActionGroup("Deploy Stage 2 SDK",
- VM.CopyFolder(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, installedSdkFolder),
+ VM.CopyFolder(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, installedSdkFolder),
ChangeVersionFileContents(existingVersionToOverwrite))
.Execute()
.Should()
@@ -177,7 +177,7 @@ private VMWriteFileAction ChangeVersionFileContents(string sdkVersion)
var installedSdkFolder = $@"c:\Program Files\dotnet\sdk\{sdkVersion}";
var vmVersionFilePath = Path.Combine(installedSdkFolder, ".version");
- var newVersionFileContents = File.ReadAllLines(Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, ".version"));
+ var newVersionFileContents = File.ReadAllLines(Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, ".version"));
newVersionFileContents[1] = sdkVersion;
return VM.WriteFile(vmVersionFilePath, string.Join(Environment.NewLine, newVersionFileContents));
diff --git a/test/dotnet-format.UnitTests/Analyzers/AnalyzerAssemblyGenerator.cs b/test/dotnet-format.UnitTests/Analyzers/AnalyzerAssemblyGenerator.cs
index c9d1b68b5905..b04f60a03533 100644
--- a/test/dotnet-format.UnitTests/Analyzers/AnalyzerAssemblyGenerator.cs
+++ b/test/dotnet-format.UnitTests/Analyzers/AnalyzerAssemblyGenerator.cs
@@ -35,7 +35,7 @@ private static async Task> GetReferencesAsync()
// Resolve the targeting pack and the target framework used to compile the test assembly.
var sdkTargetFrameworkTargetingPackVersion = (string)AppContext.GetData("ReferenceAssemblies.SdkTargetFramework.TargetingPackVersion")!;
var sdkTargetFrameworkTargetFramework = (string)AppContext.GetData("ReferenceAssemblies.SdkTargetFramework.TargetFramework")!;
- var nugetConfigPath = Path.Combine(TestContext.Current.TestExecutionDirectory, "NuGet.config");
+ var nugetConfigPath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "NuGet.config");
ReferenceAssemblies sdkTargetFrameworkReferenceAssemblies = new(sdkTargetFrameworkTargetFramework,
new PackageIdentity("Microsoft.NETCore.App.Ref", sdkTargetFrameworkTargetingPackVersion),
Path.Combine("ref", sdkTargetFrameworkTargetFramework));
diff --git a/test/dotnet-format.UnitTests/Utilities/TestProjectsPathHelper.cs b/test/dotnet-format.UnitTests/Utilities/TestProjectsPathHelper.cs
index 14c67d0fcae8..0ad8e4a273a5 100644
--- a/test/dotnet-format.UnitTests/Utilities/TestProjectsPathHelper.cs
+++ b/test/dotnet-format.UnitTests/Utilities/TestProjectsPathHelper.cs
@@ -12,7 +12,7 @@ public static string GetProjectsDirectory()
{
if (s_projectsDirectory == null)
{
- var assetsDirectory = Path.Combine(TestContext.Current.TestAssetsDirectory, "dotnet-format");
+ var assetsDirectory = Path.Combine(SdkTestContext.Current.TestAssetsDirectory, "dotnet-format");
if (Directory.Exists(assetsDirectory))
{
s_projectsDirectory = assetsDirectory;
diff --git a/test/dotnet-new.IntegrationTests/BaseIntegrationTest.cs b/test/dotnet-new.IntegrationTests/BaseIntegrationTest.cs
index 4897f4778983..506e32d5e634 100644
--- a/test/dotnet-new.IntegrationTests/BaseIntegrationTest.cs
+++ b/test/dotnet-new.IntegrationTests/BaseIntegrationTest.cs
@@ -14,7 +14,7 @@ public BaseIntegrationTest(ITestOutputHelper log) : base(log)
///
/// Gets a path to the folder with dotnet new test assets.
///
- public static string DotnetNewTestAssets { get; } = VerifyExists(Path.Combine(TestContext.Current.TestAssetsDirectory, "TestPackages", "dotnet-new"));
+ public static string DotnetNewTestAssets { get; } = VerifyExists(Path.Combine(SdkTestContext.Current.TestAssetsDirectory, "TestPackages", "dotnet-new"));
///
/// Gets a path to the folder with dotnet new test NuGet template packages.
@@ -178,7 +178,7 @@ private static string VerifyFileExists(string file)
private static string GetAndVerifyRepoRoot()
{
- string repoRoot = Path.GetFullPath(Path.Combine(TestContext.Current.TestAssetsDirectory, "..", ".."));
+ string repoRoot = Path.GetFullPath(Path.Combine(SdkTestContext.Current.TestAssetsDirectory, "..", ".."));
if (!Directory.Exists(repoRoot))
{
Assert.Fail($"The repo root cannot be evaluated.");
diff --git a/test/dotnet-new.IntegrationTests/CommonTemplatesTests.cs b/test/dotnet-new.IntegrationTests/CommonTemplatesTests.cs
index 3bb70de4aacf..3c21a97d7b7b 100644
--- a/test/dotnet-new.IntegrationTests/CommonTemplatesTests.cs
+++ b/test/dotnet-new.IntegrationTests/CommonTemplatesTests.cs
@@ -60,7 +60,7 @@ public CommonTemplatesTests(SharedHomeDirectory fixture, ITestOutputHelper log)
public async Task AllCommonItemsCreate(string expectedTemplateName, string templateShortName, string[]? args)
{
Dictionary environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() };
- TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
+ SdkTestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
string itemName = expectedTemplateName.Replace(' ', '-').Replace('.', '-');
@@ -72,7 +72,7 @@ public async Task AllCommonItemsCreate(string expectedTemplateName, string templ
VerifyCommandOutput = true,
VerificationExcludePatterns = new[] { "*/stderr.txt", "*\\stderr.txt" },
SettingsDirectory = _fixture.HomeDirectory,
- DotnetExecutablePath = TestContext.Current.ToolsetUnderTest?.DotNetHostPath,
+ DotnetExecutablePath = SdkTestContext.Current.ToolsetUnderTest?.DotNetHostPath,
DoNotPrependTemplateNameToScenarioName = true,
UniqueFor = expectedTemplateName.Equals("NuGet Config") ? UniqueForOption.OsPlatform : null,
}
@@ -204,7 +204,7 @@ public async Task AotVariants(string name, string language)
string finalProjectName = Path.Combine(projectDir, $"{projName}.{extension}");
Dictionary environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() };
- TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
+ SdkTestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: name)
{
@@ -217,7 +217,7 @@ public async Task AotVariants(string name, string language)
DoNotAppendTemplateArgsToScenarioName = true,
ScenarioName = language.Replace('#', 's').ToLower(),
VerificationExcludePatterns = new[] { "*/stderr.txt", "*\\stderr.txt" },
- DotnetExecutablePath = TestContext.Current.ToolsetUnderTest?.DotNetHostPath,
+ DotnetExecutablePath = SdkTestContext.Current.ToolsetUnderTest?.DotNetHostPath,
}
.WithCustomEnvironment(environmentUnderTest!)
.WithCustomScrubbers(
@@ -399,7 +399,7 @@ public async Task FeaturesSupport(
Dictionary environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() };
environmentUnderTest["CheckEolTargetFramework"] = false.ToString();
- TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
+ SdkTestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: name)
{
@@ -416,7 +416,7 @@ public async Task FeaturesSupport(
+ '#' + (language == null ? "cs" : language.Replace('#', 's').ToLower())
+ (langVersion == null ? "#NoLangVer" : (langVersionUnsupported ? "#UnsuportedLangVer" : null)),
VerificationExcludePatterns = new[] { "*/stderr.txt", "*\\stderr.txt" },
- DotnetExecutablePath = TestContext.Current.ToolsetUnderTest?.DotNetHostPath,
+ DotnetExecutablePath = SdkTestContext.Current.ToolsetUnderTest?.DotNetHostPath,
}
.WithCustomEnvironment(environmentUnderTest!)
.WithCustomScrubbers(
diff --git a/test/dotnet-new.IntegrationTests/DotnetClassTemplateTests.cs b/test/dotnet-new.IntegrationTests/DotnetClassTemplateTests.cs
index b2df521ebd2f..07b0f6b18921 100644
--- a/test/dotnet-new.IntegrationTests/DotnetClassTemplateTests.cs
+++ b/test/dotnet-new.IntegrationTests/DotnetClassTemplateTests.cs
@@ -47,7 +47,7 @@ public async Task DotnetCSharpClassTemplatesTest(
{
// prevents logging a welcome message from sdk installation
Dictionary environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() };
- TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
+ SdkTestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
string folderName = GetFolderName(templateShortName, langVersion, targetFramework);
string workingDir = CreateTemporaryFolder($"{nameof(DotnetCSharpClassTemplatesTest)}.{folderName}");
@@ -67,7 +67,7 @@ public async Task DotnetCSharpClassTemplatesTest(
"*project.*.*"
},
SettingsDirectory = _fixture.HomeDirectory,
- DotnetExecutablePath = TestContext.Current.ToolsetUnderTest?.DotNetHostPath,
+ DotnetExecutablePath = SdkTestContext.Current.ToolsetUnderTest?.DotNetHostPath,
DoNotAppendTemplateArgsToScenarioName = true,
DoNotPrependTemplateNameToScenarioName = true,
ScenarioName = folderName,
@@ -127,7 +127,7 @@ public async Task DotnetVisualBasicClassTemplatesTest(
{
// prevents logging a welcome message from sdk installation
Dictionary environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() };
- TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
+ SdkTestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
string folderName = GetFolderName(templateShortName, langVersion, targetFramework);
string workingDir = CreateTemporaryFolder($"{nameof(DotnetVisualBasicClassTemplatesTest)}.{folderName}");
@@ -147,7 +147,7 @@ public async Task DotnetVisualBasicClassTemplatesTest(
"*project.*.*"
},
SettingsDirectory = _fixture.HomeDirectory,
- DotnetExecutablePath = TestContext.Current.ToolsetUnderTest?.DotNetHostPath,
+ DotnetExecutablePath = SdkTestContext.Current.ToolsetUnderTest?.DotNetHostPath,
DoNotAppendTemplateArgsToScenarioName = true,
DoNotPrependTemplateNameToScenarioName = true,
ScenarioName = folderName,
diff --git a/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.cs b/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.cs
index f774b0892b0f..83fdec733ac7 100644
--- a/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.cs
+++ b/test/dotnet-new.IntegrationTests/DotnetNewInstantiateTests.cs
@@ -361,7 +361,7 @@ public void WhenSwitchIsSkippedThenItPrintsError()
cmd.ExitCode.Should().NotBe(0);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
cmd.StdErr.Should().StartWith("No templates or subcommands found");
}
@@ -436,7 +436,7 @@ public void WhenTemplateNameIsNotUniquelyMatchedThenItIndicatesProblemToUser()
cmd.ExitCode.Should().NotBe(0);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
cmd.StdErr.Should().StartWith("No templates or subcommands found matching: 'c'.");
}
diff --git a/test/dotnet-new.IntegrationTests/TemplateEngineSamplesTest.cs b/test/dotnet-new.IntegrationTests/TemplateEngineSamplesTest.cs
index 525a3e7ff848..33eeadeb7e98 100644
--- a/test/dotnet-new.IntegrationTests/TemplateEngineSamplesTest.cs
+++ b/test/dotnet-new.IntegrationTests/TemplateEngineSamplesTest.cs
@@ -46,7 +46,7 @@ public async Task TemplateEngineSamplesProjectTest(
{
_log.LogInformation($"Template with {caseDescription}");
Dictionary environmentUnderTest = new() { ["DOTNET_NOLOGO"] = false.ToString() };
- TestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
+ SdkTestContext.Current.AddTestEnvironmentVariables(environmentUnderTest);
FileExtensions.AddTextExtension(".cshtml");
TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: shortName)
@@ -56,7 +56,7 @@ public async Task TemplateEngineSamplesProjectTest(
SnapshotsDirectory = "Approvals",
SettingsDirectory = _sharedHome.HomeDirectory,
DoNotAppendTemplateArgsToScenarioName = true,
- DotnetExecutablePath = TestContext.Current.ToolsetUnderTest?.DotNetHostPath,
+ DotnetExecutablePath = SdkTestContext.Current.ToolsetUnderTest?.DotNetHostPath,
DoNotPrependCallerMethodNameToScenarioName = true,
ScenarioName = $"{folderName.Substring(folderName.IndexOf("-") + 1)}{GetScenarioName(arguments)}"
}
diff --git a/test/dotnet-new.IntegrationTests/Utilities.cs b/test/dotnet-new.IntegrationTests/Utilities.cs
index cc8497a61f2d..b1094dc07108 100644
--- a/test/dotnet-new.IntegrationTests/Utilities.cs
+++ b/test/dotnet-new.IntegrationTests/Utilities.cs
@@ -15,7 +15,7 @@ internal static class Utilities
///
internal static string GetTestExecutionTempFolder()
{
- return Path.Combine(TestContext.Current.TestExecutionDirectory, "dotnet-new.IntegrationTests");
+ return Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "dotnet-new.IntegrationTests");
}
///
diff --git a/test/dotnet-watch.Tests/CommandLine/BinaryLoggerTests.cs b/test/dotnet-watch.Tests/CommandLine/BinaryLoggerTests.cs
index 8d799b136e77..13f18641ed68 100644
--- a/test/dotnet-watch.Tests/CommandLine/BinaryLoggerTests.cs
+++ b/test/dotnet-watch.Tests/CommandLine/BinaryLoggerTests.cs
@@ -39,7 +39,7 @@ public void ParseBinaryLogFilePath(string? value, string? expected, bool matches
Assert.NotNull(value);
Assert.NotNull(expected);
- var dir = TestContext.Current.TestExecutionDirectory;
+ var dir = SdkTestContext.Current.TestExecutionDirectory;
Directory.SetCurrentDirectory(dir);
var bl = new BinaryLogger() { Parameters = value };
diff --git a/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs b/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs
index 916e691c3c6a..8b34d225d718 100644
--- a/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs
+++ b/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs
@@ -545,7 +545,7 @@ public void ForwardedOptionsAndArguments_Build(string[] args, string[] buildArgs
[Fact]
public void ForwardedBuildOptions_ArtifactsPath()
{
- var path = TestContext.Current.TestAssetsDirectory;
+ var path = SdkTestContext.Current.TestAssetsDirectory;
var args = new[] { "--artifacts-path", path };
var buildArgs = new[] { NugetInteractiveProperty, @"--property:ArtifactsPath=" + path };
diff --git a/test/dotnet-watch.Tests/FileWatcher/FileWatcherTests.cs b/test/dotnet-watch.Tests/FileWatcher/FileWatcherTests.cs
index 3fc711d7352c..e5801978bf90 100644
--- a/test/dotnet-watch.Tests/FileWatcher/FileWatcherTests.cs
+++ b/test/dotnet-watch.Tests/FileWatcher/FileWatcherTests.cs
@@ -106,7 +106,7 @@ public void DirectoryWatcherMerging()
{
var logger = new TestLogger(output);
var watcher = new TestFileWatcher(logger);
- string root = TestContext.Current.TestExecutionDirectory;
+ string root = SdkTestContext.Current.TestExecutionDirectory;
var dirA = Path.Combine(root, "A");
var dirB = Path.Combine(root, "B");
diff --git a/test/dotnet-watch.Tests/HotReload/AspireHotReloadTests.cs b/test/dotnet-watch.Tests/HotReload/AspireHotReloadTests.cs
index 715c93552330..477657ecc0c7 100644
--- a/test/dotnet-watch.Tests/HotReload/AspireHotReloadTests.cs
+++ b/test/dotnet-watch.Tests/HotReload/AspireHotReloadTests.cs
@@ -109,9 +109,10 @@ public async Task Aspire_BuildError_ManualRestart()
await App.WaitUntilOutputContains("dotnet watch ⭐ Waiting for server to shutdown ...");
- await App.WaitUntilOutputContains("dotnet watch ⭐ [#1] Stop session");
- await App.WaitUntilOutputContains("dotnet watch ⭐ [#2] Stop session");
- await App.WaitUntilOutputContains("dotnet watch ⭐ [#3] Stop session");
+ // TODO: these are not reliably reported: https://github.com/dotnet/sdk/issues/53308
+ //await App.WaitUntilOutputContains("dotnet watch ⭐ [#1] Stop session");
+ //await App.WaitUntilOutputContains("dotnet watch ⭐ [#2] Stop session");
+ //await App.WaitUntilOutputContains("dotnet watch ⭐ [#3] Stop session");
// Note: do not check that 'sessionTerminated' notification is received.
// It might get cancelled and not delivered on shutdown.
diff --git a/test/dotnet-watch.Tests/HotReload/RazorHotReloadTests.cs b/test/dotnet-watch.Tests/HotReload/RazorHotReloadTests.cs
index e3f442f1e274..ae77d656a958 100644
--- a/test/dotnet-watch.Tests/HotReload/RazorHotReloadTests.cs
+++ b/test/dotnet-watch.Tests/HotReload/RazorHotReloadTests.cs
@@ -38,7 +38,6 @@ public async Task BlazorWasm(bool projectSpecifiesCapabilities)
// env variable passed when launching the server:
await App.WaitUntilOutputContains($"HOTRELOAD_DELTA_CLIENT_LOG_MESSAGES=dotnet watch 🕵️ [blazorwasm ({tfm})]");
- App.Process.ClearOutput();
// Middleware should have been loaded to blazor-devserver before the browser is launched:
await App.WaitUntilOutputContains("dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware[0]");
@@ -49,7 +48,7 @@ public async Task BlazorWasm(bool projectSpecifiesCapabilities)
await App.WaitUntilOutputContains("Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true");
// shouldn't see any agent messages (agent is not loaded into blazor-devserver):
- App.AssertOutputDoesNotContain("🕵️");
+ App.AssertOutputDoesNotContain("Loaded into process");
// Browser is launched based on blazor-devserver output "Now listening on: ...".
await App.WaitUntilOutputContains(MessageDescriptor.LaunchingBrowser.GetMessage($"http://localhost:{port}"));
diff --git a/test/dotnet-watch.Tests/TestUtilities/ModuleInitializer.cs b/test/dotnet-watch.Tests/TestUtilities/ModuleInitializer.cs
index 1248a96695a4..84836479d581 100644
--- a/test/dotnet-watch.Tests/TestUtilities/ModuleInitializer.cs
+++ b/test/dotnet-watch.Tests/TestUtilities/ModuleInitializer.cs
@@ -20,7 +20,7 @@ public static void Initialize()
// does not have any public type that has a dependency on msbuild.
// xUnit loads all public types and any reference to msbuild assembly will trigger its load.
- var toolset = TestContext.Current.ToolsetUnderTest;
+ var toolset = SdkTestContext.Current.ToolsetUnderTest;
var sdkDir = toolset.SdkFolderUnderTest;
var watchDir = Path.Combine(sdkDir, "DotnetTools", "dotnet-watch", toolset.SdkVersion, "tools", ToolsetInfo.CurrentTargetFramework, "any");
diff --git a/test/dotnet-watch.Tests/TestUtilities/TestOptions.cs b/test/dotnet-watch.Tests/TestUtilities/TestOptions.cs
index e1f9549f2a50..1605f3f58ac4 100644
--- a/test/dotnet-watch.Tests/TestUtilities/TestOptions.cs
+++ b/test/dotnet-watch.Tests/TestUtilities/TestOptions.cs
@@ -17,7 +17,7 @@ public static int GetTestPort()
public static EnvironmentOptions GetEnvironmentOptions(string workingDirectory = "", TestAsset? asset = null)
=> new(
WorkingDirectory: workingDirectory,
- SdkDirectory: TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest,
+ SdkDirectory: SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest,
LogMessagePrefix: "dotnet watch",
ProcessCleanupTimeout: null,
IsPollingEnabled: true,
diff --git a/test/dotnet-watch.Tests/Watch/WatchOutputTests.cs b/test/dotnet-watch.Tests/Watch/WatchOutputTests.cs
new file mode 100644
index 000000000000..d96f606babd8
--- /dev/null
+++ b/test/dotnet-watch.Tests/Watch/WatchOutputTests.cs
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace Microsoft.DotNet.Watch.UnitTests;
+
+public class WatchOutputTests(ITestOutputHelper logger) : DotNetWatchTestBase(logger)
+{
+ [Fact]
+ public async Task CapturesStdOutWithNoHotReload()
+ {
+ var testAsset = TestAssets.CopyTestAsset("WatchNoDepsApp")
+ .WithSource();
+
+ App.Start(testAsset, ["--no-hot-reload"]);
+
+ // Verify stdout is captured - application prints "Started" and "Process identifier"
+ await App.WaitUntilOutputContains("Started");
+ await App.WaitUntilOutputContains("Process identifier =");
+ await App.WaitUntilOutputContains("Exiting");
+ }
+}
diff --git a/test/dotnet.Tests/CommandFactoryTests/GivenADotnetToolsCommandResolver.cs b/test/dotnet.Tests/CommandFactoryTests/GivenADotnetToolsCommandResolver.cs
index 90790ec72175..0dc71732116d 100644
--- a/test/dotnet.Tests/CommandFactoryTests/GivenADotnetToolsCommandResolver.cs
+++ b/test/dotnet.Tests/CommandFactoryTests/GivenADotnetToolsCommandResolver.cs
@@ -14,7 +14,7 @@ public class GivenADotnetToolsCommandResolver : SdkTest
public GivenADotnetToolsCommandResolver(ITestOutputHelper log) : base(log)
{
- var dotnetToolPath = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "DotnetTools");
+ var dotnetToolPath = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "DotnetTools");
_dotnetToolsCommandResolver = new DotnetToolsCommandResolver(dotnetToolPath);
}
diff --git a/test/dotnet.Tests/CommandFactoryTests/GivenAProjectDependencyCommandResolver.cs b/test/dotnet.Tests/CommandFactoryTests/GivenAProjectDependencyCommandResolver.cs
index 8b646acff1a7..6d9d8f89bee0 100644
--- a/test/dotnet.Tests/CommandFactoryTests/GivenAProjectDependencyCommandResolver.cs
+++ b/test/dotnet.Tests/CommandFactoryTests/GivenAProjectDependencyCommandResolver.cs
@@ -16,7 +16,7 @@ public GivenAProjectDependencyCommandResolver(ITestOutputHelper log) : base(log)
{
Environment.SetEnvironmentVariable(
Constants.MSBUILD_EXE_PATH,
- Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "MSBuild.dll"));
+ Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "MSBuild.dll"));
_configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
}
@@ -28,7 +28,7 @@ public void ItReturnsACommandSpecWhenToolIsInAProjectRef()
_testAssetsManager.CopyTestAsset("TestAppWithProjDepTool")
.WithSource();
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
new DotnetBuildCommand(Log)
.WithWorkingDirectory(testAsset.Path)
@@ -63,7 +63,7 @@ public void ItPassesDepsfileArgToHostWhenReturningACommandSpecForMSBuildProject(
_testAssetsManager.CopyTestAsset("TestAppWithProjDepTool")
.WithSource();
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
new DotnetBuildCommand(Log)
.WithWorkingDirectory(testAsset.Path)
@@ -94,7 +94,7 @@ public void ItReturnsNullWhenCommandNameDoesNotExistInProjectDependenciesForMSBu
_testAssetsManager.CopyTestAsset("TestAppWithProjDepTool")
.WithSource();
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
new RestoreCommand(testAsset)
.Execute()
@@ -123,7 +123,7 @@ public void ItSetsDepsfileToOutputInCommandspecForMSBuild()
_testAssetsManager.CopyTestAsset("TestAppWithProjDepTool")
.WithSource();
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
new RestoreCommand(testAsset)
.Execute()
@@ -163,7 +163,7 @@ private ProjectDependenciesCommandResolver SetupProjectDependenciesCommandResolv
{
Environment.SetEnvironmentVariable(
Constants.MSBUILD_EXE_PATH,
- Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "MSBuild.dll"));
+ Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "MSBuild.dll"));
environment = environment ?? new EnvironmentProvider();
diff --git a/test/dotnet.Tests/CommandFactoryTests/GivenAProjectToolsCommandResolver.cs b/test/dotnet.Tests/CommandFactoryTests/GivenAProjectToolsCommandResolver.cs
index 08f106cce4ab..934c23fa8ba1 100644
--- a/test/dotnet.Tests/CommandFactoryTests/GivenAProjectToolsCommandResolver.cs
+++ b/test/dotnet.Tests/CommandFactoryTests/GivenAProjectToolsCommandResolver.cs
@@ -85,7 +85,7 @@ public void ItReturnsNullWhenCommandNameDoesNotExistInProjectTools()
var testInstance = _testAssetsManager.CopyTestAsset(TestProjectName)
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -109,7 +109,7 @@ public void ItReturnsACommandSpecWithDOTNETAsFileNameAndCommandNameInArgsWhenCom
var testInstance = _testAssetsManager.CopyTestAsset(TestProjectName)
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -139,7 +139,7 @@ public void ItEscapesCommandArgumentsWhenReturningACommandSpec()
var testInstance = _testAssetsManager.CopyTestAsset(TestProjectName)
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -164,7 +164,7 @@ public void ItReturnsACommandSpecWithArgsContainingCommandPathWhenReturningAComm
var testInstance = _testAssetsManager.CopyTestAsset(TestProjectName)
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -191,7 +191,7 @@ public void ItReturnsACommandSpecWithArgsContainingCommandPathWhenInvokingAToolR
var testInstance = _testAssetsManager.CopyTestAsset(TestProjectName)
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -219,7 +219,7 @@ public void ItWritesADepsJsonFileNextToTheLockfile()
.WithSource()
.WithRepoGlobalPackages();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -230,7 +230,7 @@ public void ItWritesADepsJsonFileNextToTheLockfile()
ProjectDirectory = testInstance.Path
};
- var nugetPackagesRoot = TestContext.Current.TestGlobalPackagesFolder;
+ var nugetPackagesRoot = SdkTestContext.Current.TestGlobalPackagesFolder;
var toolPathCalculator = new ToolPathCalculator(nugetPackagesRoot);
@@ -265,11 +265,11 @@ public void GenerateDepsJsonMethodDoesntOverwriteWhenDepsFileAlreadyExists()
.WithSource()
.WithRepoGlobalPackages();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
- var toolPathCalculator = new ToolPathCalculator(TestContext.Current.TestGlobalPackagesFolder);
+ var toolPathCalculator = new ToolPathCalculator(SdkTestContext.Current.TestGlobalPackagesFolder);
var lockFilePath = toolPathCalculator.GetLockFilePath(
"dotnet-portable",
@@ -302,7 +302,7 @@ public void ItDoesNotAddFxVersionAsAParamWhenTheToolDoesNotHaveThePreferclirunti
var testInstance = _testAssetsManager.CopyTestAsset(TestProjectName)
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -331,7 +331,7 @@ public void ItFindsToolsLocatedInTheNuGetFallbackFolder()
var testProjectDirectory = testInstance.Path;
var fallbackFolder = Path.Combine(testProjectDirectory, "fallbackFolder");
- var nugetConfig = UseNuGetConfigWithFallbackFolder(testInstance, fallbackFolder, TestContext.Current.TestPackages);
+ var nugetConfig = UseNuGetConfigWithFallbackFolder(testInstance, fallbackFolder, SdkTestContext.Current.TestPackages);
PopulateFallbackFolder(testProjectDirectory, fallbackFolder);
@@ -357,7 +357,7 @@ public void ItShowsAnErrorWhenTheToolDllIsNotFound()
var fallbackFolder = Path.Combine(testProjectDirectory, "fallbackFolder");
var nugetPackages = Path.Combine(testProjectDirectory, "nugetPackages");
- var nugetConfig = UseNuGetConfigWithFallbackFolder(testInstance, fallbackFolder, TestContext.Current.TestPackages);
+ var nugetConfig = UseNuGetConfigWithFallbackFolder(testInstance, fallbackFolder, SdkTestContext.Current.TestPackages);
PopulateFallbackFolder(testProjectDirectory, fallbackFolder);
@@ -429,7 +429,7 @@ private string GetToolDepsJsonGeneratorProject()
{
// When using the product, the ToolDepsJsonGeneratorProject property is used to get this path, but for testing
// we'll hard code the path inside the SDK since we don't have a project to evaluate here
- return Path.Combine(TestContext.Current.ToolsetUnderTest.SdksPath, "Microsoft.NET.Sdk", "targets", "GenerateDeps", "GenerateDeps.proj");
+ return Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdksPath, "Microsoft.NET.Sdk", "targets", "GenerateDeps", "GenerateDeps.proj");
}
}
}
diff --git a/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs b/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs
index 1130d1471133..4ff78bd9abb3 100644
--- a/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs
+++ b/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs
@@ -180,7 +180,7 @@ public void DotnetBuildDoesNotPrintCopyrightInfo()
cmd.Should().Pass();
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
cmd.Should().NotHaveStdOutContaining("Copyright (C) Microsoft Corporation. All rights reserved.");
}
@@ -341,7 +341,7 @@ public void It_resolves_analyzers_targeting_mulitple_roslyn_versions(string comp
var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: compilerApiVersion);
- NuGetConfigWriter.Write(testAsset.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testAsset.Path, SdkTestContext.Current.TestPackages);
var command = new GetValuesCommand(testAsset,
"Analyzer",
@@ -378,7 +378,7 @@ public void It_resolves_analyzers_targeting_mulitple_roslyn_versions(string comp
static readonly List nugetRoots = new()
{
- TestContext.Current.NuGetCachePath,
+ SdkTestContext.Current.NuGetCachePath,
Path.Combine(CliFolderPathCalculator.DotnetHomePath, ".dotnet", "NuGetFallbackFolder")
};
diff --git a/test/dotnet.Tests/CommandTests/New/SdkInfoProviderTests.cs b/test/dotnet.Tests/CommandTests/New/SdkInfoProviderTests.cs
index 3945e506b516..be25b9f8cb05 100644
--- a/test/dotnet.Tests/CommandTests/New/SdkInfoProviderTests.cs
+++ b/test/dotnet.Tests/CommandTests/New/SdkInfoProviderTests.cs
@@ -11,7 +11,7 @@ public class SdkInfoProviderTests
[Fact]
public async Task GetInstalledVersionsAsync_ShouldContainCurrentVersion()
{
- string? dotnetRootUnderTest = TestContext.Current.ToolsetUnderTest?.DotNetRoot;
+ string? dotnetRootUnderTest = SdkTestContext.Current.ToolsetUnderTest?.DotNetRoot;
string? pathOrig = Environment.GetEnvironmentVariable("PATH");
Environment.SetEnvironmentVariable("PATH", dotnetRootUnderTest + Path.PathSeparator + pathOrig);
diff --git a/test/dotnet.Tests/CommandTests/NuGet/GivenANuGetCommand.cs b/test/dotnet.Tests/CommandTests/NuGet/GivenANuGetCommand.cs
index a114c98a1e4d..58f4cf8c6dcd 100644
--- a/test/dotnet.Tests/CommandTests/NuGet/GivenANuGetCommand.cs
+++ b/test/dotnet.Tests/CommandTests/NuGet/GivenANuGetCommand.cs
@@ -146,7 +146,7 @@ public void ItCanUpdatePackages()
.WithSource();
var projectDirectory = testAsset.Path;
- NuGetConfigWriter.Write(projectDirectory, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(projectDirectory, SdkTestContext.Current.TestPackages);
new DotnetCommand(Log, "package", "add", "dotnet-hello@1.0.0")
.WithWorkingDirectory(projectDirectory)
diff --git a/test/dotnet.Tests/CommandTests/Pack/PackTests.cs b/test/dotnet.Tests/CommandTests/Pack/PackTests.cs
index 985547b2b91f..f875a4756bd8 100644
--- a/test/dotnet.Tests/CommandTests/Pack/PackTests.cs
+++ b/test/dotnet.Tests/CommandTests/Pack/PackTests.cs
@@ -176,7 +176,7 @@ public void ItDoesNotImplicitlyBuildAProjectWhenPackagingWithTheNoBuildOption()
.Execute("--no-build");
result.Should().Fail();
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.Should().NotHaveStdOutContaining("Restore")
.And.HaveStdOutContaining("project.assets.json");
@@ -272,7 +272,7 @@ public void DotnetPackDoesNotPrintCopyrightInfo()
result.Should().Pass();
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.Should().NotHaveStdOutContaining("Copyright (C) Microsoft Corporation. All rights reserved.");
}
diff --git a/test/dotnet.Tests/CommandTests/Publish/GivenDotnetPublishPublishesProjects.cs b/test/dotnet.Tests/CommandTests/Publish/GivenDotnetPublishPublishesProjects.cs
index 539d10fe18ec..d3054139103b 100644
--- a/test/dotnet.Tests/CommandTests/Publish/GivenDotnetPublishPublishesProjects.cs
+++ b/test/dotnet.Tests/CommandTests/Publish/GivenDotnetPublishPublishesProjects.cs
@@ -412,7 +412,7 @@ public void DotnetPublishDoesNotPrintCopyrightInfo()
cmd.Should().Pass();
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
cmd.Should().NotHaveStdOutContaining("Copyright (C) Microsoft Corporation. All rights reserved.");
}
diff --git a/test/dotnet.Tests/CommandTests/Run/GivenDotnetRootEnv.cs b/test/dotnet.Tests/CommandTests/Run/GivenDotnetRootEnv.cs
index dd1ea3ad7f11..a67b47b1c29c 100644
--- a/test/dotnet.Tests/CommandTests/Run/GivenDotnetRootEnv.cs
+++ b/test/dotnet.Tests/CommandTests/Run/GivenDotnetRootEnv.cs
@@ -19,7 +19,7 @@ public GivenDotnetRootEnv(ITestOutputHelper log) : base(log)
[InlineData(ToolsetInfo.CurrentTargetFramework)]
public void ItShouldSetDotnetRootToDirectoryOfMuxer(string targetFramework)
{
- string expectDotnetRoot = TestContext.Current.ToolsetUnderTest.DotNetRoot;
+ string expectDotnetRoot = SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
string expectOutput = GetExpectOutput(expectDotnetRoot, targetFramework);
var projectRoot = SetupDotnetRootEchoProject(null, targetFramework);
diff --git a/test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs b/test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs
index fea920dd5511..dc6df9a0e405 100644
--- a/test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs
+++ b/test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs
@@ -80,7 +80,7 @@ public void ItDoesNotImplicitlyBuildAProjectWhenRunningWithTheNoBuildOption()
.Execute("--no-build", "-v:m");
result.Should().Fail();
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.Should().NotHaveStdOutContaining("Restore");
}
@@ -705,7 +705,7 @@ public void ItRunsWithTheSpecifiedVerbosity()
result.Should().Pass()
.And.HaveStdOutContaining("Hello World!");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.Should().HaveStdOutContaining("Restore")
.And.HaveStdOutContaining("CoreCompile");
@@ -1035,7 +1035,7 @@ public void ItProvidesConsistentErrorMessageWhenProjectFileDoesNotExistWithNoBui
.Execute("--project", nonExistentProject, "--no-build");
result.Should().Fail();
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
// After the fix, we should get a clear error message about the file not existing
var stderr = result.StdErr;
@@ -1079,7 +1079,7 @@ public void ItCanRunWithExecutableLaunchProfile()
.WithWorkingDirectory(testInstance.Path)
.Execute()
.Should().Pass()
- .And.HaveStdOutContaining(TestContext.Current.ToolsetUnderTest.SdkVersion);
+ .And.HaveStdOutContaining(SdkTestContext.Current.ToolsetUnderTest.SdkVersion);
}
}
}
diff --git a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
index 61e8f00b7524..41ca170479c3 100644
--- a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
+++ b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
@@ -129,7 +129,7 @@ private static string PrepareOutOfTreeBaseDirectory()
Directory.CreateDirectory(outOfTreeBaseDirectory);
// Create NuGet.config in our out-of-tree base directory.
- var sourceNuGetConfig = Path.Join(TestContext.Current.TestExecutionDirectory, "NuGet.config");
+ var sourceNuGetConfig = Path.Join(SdkTestContext.Current.TestExecutionDirectory, "NuGet.config");
var targetNuGetConfig = Path.Join(outOfTreeBaseDirectory, "NuGet.config");
File.Copy(sourceNuGetConfig, targetNuGetConfig, overwrite: true);
@@ -3945,9 +3945,9 @@ public void CscArguments()
var msbuildCallArgsString = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(msbuildCallArgs);
// Generate argument template code.
- string sdkPath = NormalizePath(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest);
- string dotNetRootPath = NormalizePath(TestContext.Current.ToolsetUnderTest.DotNetRoot);
- string nuGetCachePath = NormalizePath(TestContext.Current.NuGetCachePath!);
+ string sdkPath = NormalizePath(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest);
+ string dotNetRootPath = NormalizePath(SdkTestContext.Current.ToolsetUnderTest.DotNetRoot);
+ string nuGetCachePath = NormalizePath(SdkTestContext.Current.NuGetCachePath!);
string artifactsDirNormalized = NormalizePath(artifactsDir);
string objPath = $"{artifactsDirNormalized}/obj/debug";
string entryPointPathNormalized = NormalizePath(entryPointPath);
@@ -4148,7 +4148,7 @@ public static IEnumerable GetPathsOfCscInputsFromNuGetCache()
// Save the code.
var codeFolder = new DirectoryInfo(Path.Join(
- TestContext.Current.ToolsetUnderTest.RepoRoot,
+ SdkTestContext.Current.ToolsetUnderTest.RepoRoot,
"src", "Cli", "dotnet", "Commands", "Run"));
var nonGeneratedFile = codeFolder.File("CSharpCompilerCommand.cs");
if (!nonGeneratedFile.Exists)
@@ -4804,7 +4804,7 @@ public void CscOnly_DotNetRoot()
}
""");
- var expectedDotNetRoot = TestContext.Current.ToolsetUnderTest.DotNetRoot;
+ var expectedDotNetRoot = SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
var cscResult = new DotnetCommand(Log, "run", "Program.cs", "-bl")
.WithWorkingDirectory(testInstance.Path)
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndDiscoversTests.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndDiscoversTests.cs
index eaf2dcfa49cf..15cab10a8fa2 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndDiscoversTests.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndDiscoversTests.cs
@@ -26,7 +26,7 @@ public void DiscoverTestProjectWithNoTests_ShouldReturnExitCodeGenericFailure(st
.WithWorkingDirectory(testInstance.Path)
.Execute("--list-tests", "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", true, configuration, "Discovered 0 tests"), result.StdOut);
@@ -49,7 +49,7 @@ public void DiscoverMultipleTestProjectsWithNoTests_ShouldReturnExitCodeGenericF
.WithWorkingDirectory(testInstance.Path)
.Execute("--list-tests", "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", true, configuration, "Discovered 0 tests"), result.StdOut);
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("OtherTestProject", true, configuration, "Discovered 0 tests"), result.StdOut);
@@ -72,7 +72,7 @@ public void DiscoverTestProjectWithTests_ShouldReturnExitCodeSuccess(string conf
.WithWorkingDirectory(testInstance.Path)
.Execute("--list-tests", "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", true, configuration, "Discovered 1 tests", ["Test0"]), result.StdOut);
Assert.Matches(@"Discovered 1 tests.*", result.StdOut);
@@ -93,7 +93,7 @@ public void DiscoverMultipleTestProjectsWithTests_ShouldReturnExitCodeSuccess(st
.WithWorkingDirectory(testInstance.Path)
.Execute("--list-tests", "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", true, configuration, "Discovered 2 tests", ["Test0", "Test2"]), result.StdOut);
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("OtherTestProject", true, configuration, "Discovered 1 tests", ["Test1"]), result.StdOut);
@@ -118,7 +118,7 @@ public void DiscoverProjectWithMSTestMetaPackageAndMultipleTFMsWithTests_ShouldR
.WithWorkingDirectory(testInstance.Path)
.Execute("--list-tests", "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", false, configuration, "Discovered 3 tests", ["TestMethod1", "TestMethod2", "TestMethod3"]), result.StdOut);
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", true, configuration, "Discovered 2 tests", ["TestMethod1", "TestMethod3"]), result.StdOut);
@@ -139,7 +139,7 @@ public void DiscoverTestProjectsWithHybridModeTestRunners_ShouldReturnExitCodeGe
.WithWorkingDirectory(testInstance.Path)
.Execute("--list-tests", "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain(string.Format(CliCommandStrings.CmdUnsupportedVSTestTestApplicationsDescription, "AnotherTestProject.csproj"));
}
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsHelp.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsHelp.cs
index 7c6b039a0f99..62399e5c3095 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsHelp.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsHelp.cs
@@ -25,7 +25,7 @@ public void RunHelpOnTestProject_ShouldReturnExitCodeSuccess(string configuratio
.WithWorkingDirectory(testInstance.Path)
.Execute(CliConstants.HelpOptionKey, "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(@"Extension Options:\s+--[\s\S]*", result.StdOut);
Assert.Matches(@"Options:\s+--[\s\S]*", result.StdOut);
@@ -49,7 +49,7 @@ public void RunHelpOnMultipleTestProjects_ShouldReturnExitCodeSuccess(string con
.WithWorkingDirectory(testInstance.Path)
.Execute(CliConstants.HelpOptionKey, "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(@"Extension Options:\s+--[\s\S]*", result.StdOut);
Assert.Matches(@"Options:\s+--[\s\S]*", result.StdOut);
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestBasedOnGlobbingFilter.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestBasedOnGlobbingFilter.cs
index eba16e82a7cc..41d18508f345 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestBasedOnGlobbingFilter.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestBasedOnGlobbingFilter.cs
@@ -34,7 +34,7 @@ public void RunTestProjectWithFilterOfDll_ShouldReturnExitCodeSuccess()
Assert.Equal(binDirectoryLastWriteTime, binDirectory?.LastWriteTime);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Passed, true, TestingConstants.Debug), result.StdOut);
@@ -75,7 +75,7 @@ public void RunTestProjectsWithFilterOfDll_ShouldReturnExitCodeGenericFailure()
// Assert that the bin folder hasn't been modified
Assert.Equal(binDirectoryLastWriteTime, binDirectory?.LastWriteTime);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Failed, true, TestingConstants.Debug), result.StdOut);
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("OtherTestProject", TestingConstants.Passed, true, TestingConstants.Debug), result.StdOut);
@@ -111,7 +111,7 @@ public void RunTestProjectWithFilterOfDllWithRootDirectory_ShouldReturnExitCodeS
.Execute("--test-modules", $"**/bin/**/Debug/{ToolsetInfo.CurrentTargetFramework}/TestProject.dll".Replace('/', Path.DirectorySeparatorChar),
"--root-directory", testInstance.TestRoot);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Passed, true, TestingConstants.Debug), result.StdOut);
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs
index a92ea93517ea..101e1d562c16 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs
@@ -24,7 +24,7 @@ public void MStestMultiTFM()
.WithVersionVariables()
.Path;
- NuGetConfigWriter.Write(testProjectDirectory, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testProjectDirectory, SdkTestContext.Current.TestPackages);
var runtime = EnvironmentInfo.GetCompatibleRid();
@@ -37,7 +37,7 @@ public void MStestMultiTFM()
.WithWorkingDirectory(testProjectDirectory)
.Execute(ConsoleLoggerOutputNormal);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 3")
@@ -75,7 +75,7 @@ public void XunitMultiTFM()
.Execute(ConsoleLoggerOutputNormal);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
// for target framework net46
result.StdOut.Should().Contain("Total tests: 3");
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromDll.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromDll.cs
index 2d8d3d6afb89..a3c53e1bfd60 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromDll.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestFromDll.cs
@@ -36,7 +36,7 @@ public void TestsFromAGivenContainerShouldRunWithExpectedOutput()
// Call vstest
var result = new DotnetTestCommand(Log, disableNewOutput: false)
.Execute(outputDll, "--logger:console;verbosity=normal");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 2")
@@ -100,7 +100,7 @@ public void TestsFromAGivenContainerAndArchSwitchShouldFlowToVsTestConsole()
// Call vstest
var result = new DotnetTestCommand(Log, disableNewOutput: true)
.Execute(outputDll, "--arch", "wrongArchitecture");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().StartWith("Invalid platform type: wrongArchitecture. Valid platform types are ");
}
@@ -124,7 +124,7 @@ public void MissingOutputDllAndArgumentsEndWithDllOrExeShouldFailInMSBuild(strin
var result = new DotnetTestCommand(Log, disableNewOutput: true)
.Execute(arg);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.");
}
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs
index 6c054f61ceed..1973e5e38016 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs
@@ -26,7 +26,7 @@ public void MSTestSingleTFM()
.Execute(ConsoleLoggerOutputNormal);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -52,7 +52,7 @@ public void ItImplicitlyRestoresAProjectWhenTesting()
.WithWorkingDirectory(testProjectDirectory)
.Execute(ConsoleLoggerOutputNormal);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -122,7 +122,7 @@ public void XunitSingleTFM()
.Execute(ConsoleLoggerOutputNormal);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -147,7 +147,7 @@ public void GivenAFailingTestItDisplaysFailureDetails()
result.ExitCode.Should().Be(1);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Failed TestNamespace.VSTestXunitTests.VSTestXunitFailTest");
result.StdOut.Should().Contain("Total: 2");
@@ -177,7 +177,7 @@ public void ItAcceptsMultipleLoggersAsCliArguments()
"console;verbosity=normal", "--", "RunConfiguration.ResultsDirectory=" + trxLoggerDirectory);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
// We append current date time to trx file name, hence modifying this check
Assert.True(Directory.EnumerateFiles(trxLoggerDirectory, trxFileNamePattern).Any());
@@ -209,7 +209,7 @@ public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
.Execute("--no-build", "-v:m");
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().NotContain("Restore");
// https://github.com/dotnet/sdk/issues/3684
@@ -321,7 +321,7 @@ public void ItBuildsAndTestsAppWhenRestoringToSpecificDirectory()
.WithWorkingDirectory(rootPath)
.Execute("--no-restore");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -350,7 +350,7 @@ public void ItUsesVerbosityPassedToDefineVerbosityOfConsoleLoggerOfTheTests(stri
.Execute("-v", verbosity);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
if (shouldShowPassedTests)
{
@@ -400,7 +400,7 @@ public void ItTestsWithTheSpecifiedRuntimeOption()
.And
.HaveStdOutContaining(rid);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -422,7 +422,7 @@ public void ItAcceptsNoLogoAsCliArguments()
.Execute("--nologo");
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().NotContain("Microsoft (R) Test Execution Command Line Tool Version");
result.StdOut.Should().Contain("Total: 2");
@@ -457,7 +457,7 @@ public void ItCreatesCoverageFileWhenCodeCoverageEnabledByRunsettings()
result.StdOut + Environment.NewLine + result.StdErr);
// Verify test results
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -493,7 +493,7 @@ public void ItCreatesCoverageFileInResultsDirectory()
"--results-directory", resultsDirectory);
// Verify test results
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -529,7 +529,7 @@ public void ItCreatesCoberturaFileProvidedByCommandInResultsDirectory()
"--results-directory", resultsDirectory);
// Verify test results
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -566,7 +566,7 @@ public void ItHandlesMultipleCollectCommandInResultsDirectory()
"--results-directory", resultsDirectory);
// Verify test results
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -598,7 +598,7 @@ public void ItShouldShowWarningMessageOnCollectCodeCoverage()
"--filter", "VSTestPassTest");
// Verify test results
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("No code coverage data available. Code coverage is currently supported only on Windows, Linux x64 and macOS x64.");
result.StdOut.Should().Contain("Total: 1");
@@ -626,7 +626,7 @@ public void ItShouldShowImportantMessage()
.Execute();
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Important text");
}
@@ -673,7 +673,7 @@ public void TestsFromCsprojAndArchSwitchShouldFlowToMsBuild()
.Execute("--arch", "wrongArchitecture");
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("error NETSDK1083: The specified RuntimeIdentifier");
result.StdOut.Should().Contain("wrongArchitecture");
@@ -701,7 +701,7 @@ public void FilterPropertyCorrectlyHandlesComma(string filter, string folderSuff
.Execute("--filter", filter);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 1");
result.StdOut.Should().Contain("Passed: 1");
@@ -724,7 +724,7 @@ public void EnsureOutputPathEscaped(string flag)
.Execute(flag, pathWithComma);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -772,7 +772,7 @@ public void PathEndsWithSlashOrBackslash(string flag, string slashesOrBackslashe
.Execute(flag, flagDirectory + slashesOrBackslashes);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -795,7 +795,7 @@ public void ArgumentsEndWithDllOrExeShouldNotFail(string arg)
.Execute(testProjectDirectory, arg);
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -824,7 +824,7 @@ public void PropertiesEndingWithDotDllShouldNotFail(string property)
.Execute(ConsoleLoggerOutputNormal.Concat([property]));
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("Total tests: 2");
result.StdOut.Should().Contain("Passed: 1");
@@ -845,7 +845,7 @@ public void DistributedLoggerEndingWithDotDllShouldBePassedToMSBuild()
.WithWorkingDirectory(testProjectDirectory)
.Execute(ConsoleLoggerOutputNormal.Concat(["-dl:my.dll"]));
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
// This ensures that this was passed to MSBuild and not vstest.console.
result.StdOut.Should().Contain("error MSB1021: Cannot create an instance of the logger my.dll.");
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsprojWithCorrectTestRunParameters.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsprojWithCorrectTestRunParameters.cs
index cd533e66e163..d6fe35d4c4ee 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsprojWithCorrectTestRunParameters.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsprojWithCorrectTestRunParameters.cs
@@ -30,7 +30,7 @@ public void GivenAProjectAndMultipleTestRunParametersItPassesThemToVStestConsole
}));
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().NotMatch("The test run parameter argument '*' is invalid.");
result.StdOut.Should().Contain("Total tests: 1");
@@ -64,7 +64,7 @@ public void GivenADllAndMultipleTestRunParametersItPassesThemToVStestConsoleInTh
}));
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().NotMatch("The test run parameter argument '*' is invalid.");
result.StdOut.Should().Contain("Total tests: 1");
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs
index 307e257ed6c1..dd9609c853cf 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs
@@ -30,7 +30,7 @@ public void RunTestProjectWithNoTests_ShouldReturnExitCodeZeroTests(string confi
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Zero tests ran")
@@ -55,7 +55,7 @@ public void RunTestProjectWithWithRetryFeature_ShouldSucceed(string configuratio
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("(try 2)")
@@ -82,7 +82,7 @@ public void RunMultipleTestProjectsWithNoTests_ShouldReturnExitCodeZeroTests(str
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Zero tests ran")
@@ -108,7 +108,7 @@ public void RunTestProjectWithTests_ShouldReturnExitCodeSuccess(string configura
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Passed!")
@@ -156,7 +156,7 @@ public void RunTestProjectWithTestsAndLaunchSettings_ShouldReturnExitCodeSuccess
.WithEnvironmentVariable("TEST_ENV_VAR", "TestValue1")
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Using launch settings from")
@@ -255,7 +255,7 @@ public void RunMultipleTestProjectsWithFailingTests_ShouldReturnExitCodeAtLeastO
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Failed!")
@@ -281,7 +281,7 @@ public void RunMultipleTestProjectsWithDifferentFailures_ShouldReturnExitCodeGen
.Execute("--minimum-expected-tests", "2",
"-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.ZeroTestsRan, true, configuration, "8"), result.StdOut);
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("OtherTestProject", TestingConstants.Failed, true, configuration, "2"), result.StdOut);
@@ -310,7 +310,7 @@ public void RunTestProjectsWithHybridModeTestRunners_ShouldReturnExitCodeGeneric
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain(string.Format(CliCommandStrings.CmdUnsupportedVSTestTestApplicationsDescription, "AnotherTestProject.csproj"));
}
@@ -330,7 +330,7 @@ public void RunTestProjectsWithClassLibraryHavingIsTestProjectAndMTPProject_Shou
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain(string.Format(CliCommandStrings.CmdUnsupportedVSTestTestApplicationsDescription, "AnotherTestProject.csproj"));
}
@@ -350,7 +350,7 @@ public void RunOnEmptyFolder_ShouldReturnExitCodeGenericFailure(string configura
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain(CliCommandStrings.CmdNoProjectOrSolutionFileErrorDescription);
}
@@ -370,7 +370,7 @@ public void RunOnMultipleProjectFoldersWithoutSolutionFile_ShouldReturnExitCodeG
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain(CliCommandStrings.CmdNoProjectOrSolutionFileErrorDescription);
}
@@ -390,7 +390,7 @@ public void RunOnProjectWithSolutionFile_ShouldReturnExitCodeGenericFailure(stri
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain(CliCommandStrings.CmdMultipleProjectOrSolutionFilesErrorDescription);
}
@@ -416,7 +416,7 @@ public void RunOnProjectWithClassLibrary_ShouldReturnExitCodeSuccess(
.WithWorkingDirectory(testInstance.Path)
.Execute(args);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Passed!")
@@ -446,7 +446,7 @@ public void RunningWithGlobalPropertyShouldProperlyPropagate(string configuratio
"-c", configuration,
"--property", "PROPERTY_TO_ENABLE_MTP=1");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Passed!")
@@ -504,7 +504,7 @@ public void RunMTPProjectThatCrashesWithExitCodeZero_ShouldFail()
.Execute();
result.ExitCode.Should().NotBe(ExitCodes.Success);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
/*
The following exception occurred when running the test module with RunCommand 'C:\Users\ygerges\Desktop\sdk\artifacts\tmp\Debug\testing\19cefafa-91c4---0D0799BD\TestProject1\bin\Debug\net10.0\TestProject1.exe' and RunArguments ' ':
@@ -542,7 +542,7 @@ public void RunMTPProjectThatCrashesWithExitCodeNonZero_ShouldFail_WithSameExitC
// The test asset exits with Environment.Exit(47);
result.ExitCode.Should().Be(47);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().NotContain("A test session start event was received without a corresponding test session end");
@@ -573,7 +573,7 @@ public void RunTestProjectWithEnvVariable(string configuration)
"-c", configuration,
"--environment", "DUMMY_TEST_ENV_VAR=ENV_VAR_CMD_LINE");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Using launch settings from")
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsForMultipleTFMs.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsForMultipleTFMs.cs
index 08ae170e6db3..84b369490ba6 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsForMultipleTFMs.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsForMultipleTFMs.cs
@@ -29,7 +29,7 @@ public void RunMultipleProjectWithDifferentTFMs_ShouldReturnExitCodeGenericFailu
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
MatchCollection previousDotnetProjectMatches = Regex.Matches(result.StdOut!, RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Failed, useCurrentVersion: false, configuration));
MatchCollection currentDotnetProjectMatches = Regex.Matches(result.StdOut!, RegexPatternHelper.GenerateProjectRegexPattern("OtherTestProject", TestingConstants.Passed, useCurrentVersion: true, configuration));
@@ -69,7 +69,7 @@ public void RunProjectWithMultipleTFMs_ShouldReturnExitCodeGenericFailure(string
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
MatchCollection previousDotnetProjectMatches = Regex.Matches(result.StdOut!, RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Failed, useCurrentVersion: false, configuration));
MatchCollection currentDotnetProjectMatches = Regex.Matches(result.StdOut!, RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Failed, useCurrentVersion: true, configuration));
@@ -119,7 +119,7 @@ public void RunProjectWithMultipleTFMs_ParallelizationTest_RunInParallelShouldFa
if (testTfmsInParallel)
{
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Failed!")
@@ -158,7 +158,7 @@ public void RunProjectWithMultipleTFMsWithArchOption_ShouldReturnExitCodeGeneric
.Execute("-c", configuration,
"--arch", arch);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("error NETSDK1134: Building a solution with a specific RuntimeIdentifier is not supported. If you would like to publish for a single RID, specify the RID at the individual project level instead.");
}
@@ -185,7 +185,7 @@ public void RunProjectWithMSTestMetaPackageAndMultipleTFMs_ShouldReturnExitCodeG
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
MatchCollection previousDotnetProjectMatches = Regex.Matches(result.StdOut!, RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Failed, useCurrentVersion: false, configuration));
MatchCollection currentDotnetProjectMatches = Regex.Matches(result.StdOut!, RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Failed, useCurrentVersion: true, configuration));
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs
index 6736b5809c51..f7d25995d8eb 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs
@@ -25,7 +25,7 @@ public void RunTestProjectWithFailingTestsAndFileArtifacts_ShouldReturnExitCodeG
.WithWorkingDirectory(testInstance.Path)
.Execute("-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(@".*Test6.*testNodeFile.txt", result.StdOut);
@@ -55,7 +55,7 @@ public void RunTestProjectWithCodeCoverage_ShouldReturnExitCodeGenericFailure(st
// Read MSTestPackageVersion from Version.Details.props and update the .csproj file
// Search for Version.Details.props file from the current directory up to the root
- string? versionsPropsPath = PathUtility.FindFileInParentDirectories(TestContext.Current.TestExecutionDirectory, $"eng{Path.DirectorySeparatorChar}Version.Details.props") ?? throw new FileNotFoundException("Version.Details.props file not found.");
+ string? versionsPropsPath = PathUtility.FindFileInParentDirectories(SdkTestContext.Current.TestExecutionDirectory, $"eng{Path.DirectorySeparatorChar}Version.Details.props") ?? throw new FileNotFoundException("Version.Details.props file not found.");
string msTestVersion = testInstance.ReadMSTestPackageVersionFromProps(versionsPropsPath);
testInstance.UpdateProjectFileWithMSTestPackageVersion(Path.Combine($@"{testInstance.Path}{PathUtility.GetDirectorySeparatorChar()}TestProject", "TestProject.csproj"), msTestVersion);
@@ -63,7 +63,7 @@ public void RunTestProjectWithCodeCoverage_ShouldReturnExitCodeGenericFailure(st
.WithWorkingDirectory(testInstance.Path)
.Execute("--coverage", "-c", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
string pattern = $@"In\sprocess\sfile\sartifacts\sproduced:\s+.*{PathUtility.GetDirectorySeparatorChar()}TestResults{PathUtility.GetDirectorySeparatorChar()}.*\.coverage";
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs
index 76e6ba82e250..6a00c6bb073e 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs
@@ -244,7 +244,7 @@ public void RunTestProjectSolutionWithArchOption_NotSupported(string configurati
.Execute("--arch", arch,
"--configuration", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().Contain("error NETSDK1134: Building a solution with a specific RuntimeIdentifier is not supported. If you would like to publish for a single RID, specify the RID at the individual project level instead.");
}
@@ -392,7 +392,7 @@ public void RunSpecificCSProjRunsWithMSBuildArgs_ShouldReturnExitCodeSuccess(str
"--configuration", configuration,
"--property:WarningLevel=2", $"--property:Configuration={configuration}");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Passed!")
@@ -417,7 +417,7 @@ public void RunOnSolutionWithMSBuildArgs_ShouldReturnExitCodeGenericFailure(stri
.Execute("--configuration", configuration,
"--property:WarningLevel=2");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Test run summary: Failed!")
@@ -442,7 +442,7 @@ public void RunTestProjectSolutionWithFrameworkOption_ShouldReturnExitCodeSucces
.Execute("--framework", ToolsetInfo.CurrentTargetFramework,
"--configuration", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Passed, true, configuration), result.StdOut);
@@ -481,7 +481,7 @@ public void RunMultiTFMsProjectSolutionWithPreviousFramework_ShouldReturnExitCod
error NETSDK1005: Assets file 'path\to\OtherTestProject\obj\project.assets.json' doesn't have a target for 'net9.0'. Ensure that restore has run and that you have included 'net9.0' in the TargetFrameworks for your project.
Build failed with exit code: 1.
*/
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().NotContain("Test run summary")
@@ -514,7 +514,7 @@ public void RunMultiTFMsProjectSolutionWithCurrentFramework_ShouldReturnExitCode
.Execute("--framework", ToolsetInfo.CurrentTargetFramework,
"--configuration", configuration);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.Failed, true, configuration), result.StdOut);
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("OtherTestProject", TestingConstants.Passed, true, configuration), result.StdOut);
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsEnvironmentVariables.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsEnvironmentVariables.cs
index c947837ef200..b2c65ff08a69 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsEnvironmentVariables.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsEnvironmentVariables.cs
@@ -44,7 +44,7 @@ public void ItPassesEnvironmentVariablesFromCommandLineParametersWhenRunningViaC
.And.Contain(EnvironmentVariable2)
.And.Contain(EnvironmentVariable3);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 1")
@@ -87,7 +87,7 @@ public void ItPassesEnvironmentVariablesFromCommandLineParametersWhenRunningViaD
.And.Contain(EnvironmentVariable2)
.And.Contain(EnvironmentVariable3);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 1")
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsMSBuildParameters.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsMSBuildParameters.cs
index 7aa927aced10..4d3d1f87eab5 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsMSBuildParameters.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestContainsMSBuildParameters.cs
@@ -32,7 +32,7 @@ public void ItPassesEnvironmentVariablesFromCommandLineParametersWhenRunningViaC
.WithWorkingDirectory(testRoot)
.Execute("--logger", "console;verbosity=detailed", MSBuildParameter);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 1")
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestForwardDotnetRootEnvironmentVariables.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestForwardDotnetRootEnvironmentVariables.cs
index e7f6a68e8fbd..056c7d161c05 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestForwardDotnetRootEnvironmentVariables.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestForwardDotnetRootEnvironmentVariables.cs
@@ -27,7 +27,7 @@ public void ShouldForwardDotnetRootEnvironmentVariablesIfNotProvided()
command.EnvironmentToRemove.Add("DOTNET_ROOT(x86)");
var result = command.Execute(ConsoleLoggerOutputDetailed);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 1")
diff --git a/test/dotnet.Tests/CommandTests/Test/TestCommandValidationTests.cs b/test/dotnet.Tests/CommandTests/Test/TestCommandValidationTests.cs
index d5746358baca..7dac19f7d087 100644
--- a/test/dotnet.Tests/CommandTests/Test/TestCommandValidationTests.cs
+++ b/test/dotnet.Tests/CommandTests/Test/TestCommandValidationTests.cs
@@ -35,7 +35,7 @@ public void TestCommandShouldValidateFileArgumentsAndProvideHelpfulMessages(stri
.Execute("--my-arg", filename);
result.ExitCode.Should().NotBe(0);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain(expectedErrorStart);
}
@@ -61,7 +61,7 @@ public void TestCommandShouldValidateDirectoryArgumentAndProvideHelpfulMessage()
.Execute("--myarg", "test_directory");
result.ExitCode.Should().NotBe(0);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain("Specifying a directory for 'dotnet test' should be via '--project' or '--solution'.");
}
@@ -89,7 +89,7 @@ public void TestCommandShouldValidateDllArgumentAndProvideHelpfulMessage()
.Execute("--my-arg", "test.dll");
result.ExitCode.Should().NotBe(0);
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdErr.Should().Contain("Specifying dlls or executables for 'dotnet test' should be via '--test-modules'.");
}
diff --git a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs
index 6bbafee79c87..dfba1c6c4c8e 100644
--- a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs
+++ b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs
@@ -38,7 +38,7 @@ public void WhenRunWithRoot()
{
Directory.CreateDirectory("/tmp/folder/sub");
var directory = Directory.GetCurrentDirectory();
- var ridGraphPath = TestContext.GetRuntimeGraphFilePath();
+ var ridGraphPath = SdkTestContext.GetRuntimeGraphFilePath();
try
{
Directory.SetCurrentDirectory("/tmp/folder");
diff --git a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs
index d7f3f037b524..507cc7e770ce 100644
--- a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs
+++ b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs
@@ -75,7 +75,7 @@ public ToolInstallGlobalOrToolPathCommandTests(ITestOutputHelper log): base(log)
_fileSystem);
_toolPackageUninstallerMock = new ToolPackageUninstallerMock(_fileSystem, store);
_toolPackageDownloader = new ToolPackageDownloaderMock2(_toolPackageStore,
- runtimeJsonPathForTests: TestContext.GetRuntimeGraphFilePath(),
+ runtimeJsonPathForTests: SdkTestContext.GetRuntimeGraphFilePath(),
currentWorkingDirectory: null,
fileSystem: _fileSystem);
@@ -606,7 +606,7 @@ public void WhenRunWithValidVersionItShouldInterpretAsNuGetExactVersion(string v
{
const string nugetSourcePath = "https://api.nuget.org/v3/index.json";
var testDir = _testAssetsManager.CreateTestDirectory().Path;
- var ridGraphPath = TestContext.GetRuntimeGraphFilePath();
+ var ridGraphPath = SdkTestContext.GetRuntimeGraphFilePath();
var toolInstallCommand = new ToolInstallGlobalOrToolPathCommand(Parser.Parse($"dotnet tool install -g {UnlistedPackageId} --version {version} --add-source {nugetSourcePath}"),
createToolPackageStoreDownloaderUninstaller: (nonGlobalLocation, _, _) =>
diff --git a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs
index 2cf7fb17222d..63815313431c 100644
--- a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs
+++ b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs
@@ -235,7 +235,7 @@ private ToolInstallGlobalOrToolPathCommand CreateInstallCommand(string options)
var toolPackageUninstallerMock = new ToolPackageUninstallerMock(_fileSystem, store);
var toolPackageDownloaderMock = new ToolPackageDownloaderMock2(store,
- runtimeJsonPathForTests: TestContext.GetRuntimeGraphFilePath(),
+ runtimeJsonPathForTests: SdkTestContext.GetRuntimeGraphFilePath(),
currentWorkingDirectory: null,
fileSystem: _fileSystem);
diff --git a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs
index 5af8b2d15764..1b5994540b8b 100644
--- a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs
+++ b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs
@@ -93,7 +93,7 @@ public ToolUpdateGlobalOrToolPathCommandTests(ITestOutputHelper log) : base(log)
};
_toolPackageDownloader = new ToolPackageDownloaderMock2(_store,
- runtimeJsonPathForTests: TestContext.GetRuntimeGraphFilePath(),
+ runtimeJsonPathForTests: SdkTestContext.GetRuntimeGraphFilePath(),
currentWorkingDirectory: null,
fileSystem: _fileSystem);
diff --git a/test/dotnet.Tests/CommandTests/VSTest/VSTestTests.cs b/test/dotnet.Tests/CommandTests/VSTest/VSTestTests.cs
index a984ba63725f..d7b2ff7526d4 100644
--- a/test/dotnet.Tests/CommandTests/VSTest/VSTestTests.cs
+++ b/test/dotnet.Tests/CommandTests/VSTest/VSTestTests.cs
@@ -36,7 +36,7 @@ public void TestsFromAGivenContainerShouldRunWithExpectedOutput()
// Call vstest
var result = new DotnetVSTestCommand(Log)
.Execute(outputDll, "--logger:console;verbosity=normal");
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut
.Should().Contain("Total tests: 2")
@@ -77,7 +77,7 @@ public void GivenADllAndMultipleTestRunParametersItPassesThemToVStestConsoleInTh
});
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().NotMatch("The test run parameter argument '*' is invalid.");
result.StdOut.Should().Contain("Total tests: 1");
@@ -148,7 +148,7 @@ public void ItShouldAcceptMultipleLoggers()
});
// Verify
- if (!TestContext.IsLocalized())
+ if (!SdkTestContext.IsLocalized())
{
result.StdOut.Should().NotMatch("The test run parameter argument '*' is invalid.");
result.StdOut.Should().Contain("Total tests: 1");
diff --git a/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs b/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs
index 4b63850cec2c..5ee8bab0cb18 100644
--- a/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs
+++ b/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs
@@ -581,7 +581,7 @@ public void GivenWorkloadsAreOutOfDateUpdatesAreAdvertisedOnRestoringCommands(st
var testInstance = _testAssetsManager.CopyTestAsset("HelloWorld", identifier: commandName)
.WithSource()
.Restore(Log);
- var sdkFeatureBand = new SdkFeatureBand(TestContext.Current.ToolsetUnderTest.SdkVersion);
+ var sdkFeatureBand = new SdkFeatureBand(SdkTestContext.Current.ToolsetUnderTest.SdkVersion);
// Write fake updates file
Directory.CreateDirectory(Path.Combine(testInstance.Path, ".dotnet"));
File.WriteAllText(Path.Combine(testInstance.Path, ".dotnet", $".workloadAdvertisingUpdates{sdkFeatureBand}"), @"[""maui""]");
@@ -619,7 +619,7 @@ public void WorkloadUpdatesForDifferentBandAreNotAdvertised()
var testInstance = _testAssetsManager.CopyTestAsset("HelloWorld")
.WithSource()
.Restore(Log);
- var sdkFeatureBand = new SdkFeatureBand(TestContext.Current.ToolsetUnderTest.SdkVersion);
+ var sdkFeatureBand = new SdkFeatureBand(SdkTestContext.Current.ToolsetUnderTest.SdkVersion);
// Write fake updates file
Directory.CreateDirectory(Path.Combine(testInstance.Path, ".dotnet"));
File.WriteAllText(Path.Combine(testInstance.Path, ".dotnet", $".workloadAdvertisingUpdates6.0.100"), @"[""maui""]");
diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs
index b67afbf7dacd..d9baa60d9261 100644
--- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs
+++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs
@@ -243,7 +243,7 @@ public void ItCreatesThePathDFileOnMacOSWhenInvokedFromNativeInstaller()
private string GetDotnetVersion()
{
- return TestContext.Current.ToolsetUnderTest.SdkVersion;
+ return SdkTestContext.Current.ToolsetUnderTest.SdkVersion;
}
}
}
diff --git a/test/dotnet.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs b/test/dotnet.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs
index 7b70a8d92848..b77bedcd1a51 100644
--- a/test/dotnet.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs
+++ b/test/dotnet.Tests/GivenThatWeWantToBeBackwardsCompatibleWith1xProjects.cs
@@ -66,7 +66,7 @@ public void ItRunsABackwardsVersionedTool()
.CopyTestAsset("11TestAppWith10CLIToolReferences")
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
new RestoreCommand(testInstance)
.Execute()
diff --git a/test/dotnet.Tests/PackagedCommandTests.cs b/test/dotnet.Tests/PackagedCommandTests.cs
index 52b96ded37e7..61326c05f078 100644
--- a/test/dotnet.Tests/PackagedCommandTests.cs
+++ b/test/dotnet.Tests/PackagedCommandTests.cs
@@ -25,7 +25,7 @@ public void TestProjectToolIsAvailableThroughDriver(string appName)
var testInstance = _testAssetsManager.CopyTestAsset(appName)
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
new BuildCommand(testInstance)
.Execute()
@@ -47,7 +47,7 @@ public void IfPreviousVersionOfSharedFrameworkIsInstalled_ToolsTargetingItRun(bo
var testInstance = _testAssetsManager.CopyTestAsset("AppWithToolDependency", identifier: toolPrefersCLIRuntime ? "preferCLIRuntime" : "")
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance = testInstance.WithProjectChanges(project =>
{
@@ -82,7 +82,7 @@ public void IfAToolHasNotBeenRestoredForNetCoreApp2_0ItFallsBackToNetCoreApp1_x(
var testInstance = _testAssetsManager.CopyTestAsset("AppWithToolDependency")
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
string projectFolder = null;
@@ -138,7 +138,7 @@ public void CanInvokeToolWhosePackageNameIsDifferentFromDllName()
var testInstance = _testAssetsManager.CopyTestAsset("AppWithDepOnToolWithOutputName")
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
new BuildCommand(testInstance)
.Execute()
@@ -217,7 +217,7 @@ public void ToolsCanAccessDependencyContextProperly()
var testInstance = _testAssetsManager.CopyTestAsset("DependencyContextFromTool")
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
testInstance.Restore(Log);
@@ -233,7 +233,7 @@ public void TestProjectDependencyIsNotAvailableThroughDriver()
var testInstance = _testAssetsManager.CopyTestAsset("AppWithDirectDep")
.WithSource();
- NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
+ NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);
new BuildCommand(testInstance)
.Execute()
diff --git a/test/dotnet.Tests/ShellShimTests/AppHostShellShimMakerTests.cs b/test/dotnet.Tests/ShellShimTests/AppHostShellShimMakerTests.cs
index b7fc2921a5b9..d423dbe0c0c7 100644
--- a/test/dotnet.Tests/ShellShimTests/AppHostShellShimMakerTests.cs
+++ b/test/dotnet.Tests/ShellShimTests/AppHostShellShimMakerTests.cs
@@ -34,7 +34,7 @@ private static string CreateApphostAndReturnShimPath()
{
var tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(tempDirectory);
- var appHostShellShimMaker = new AppHostShellShimMaker(Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "AppHostTemplate"));
+ var appHostShellShimMaker = new AppHostShellShimMaker(Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "AppHostTemplate"));
string shimPath = Path.Combine(tempDirectory, Path.GetRandomFileName());
appHostShellShimMaker.CreateApphostShellShim(
diff --git a/test/dotnet.Tests/ShellShimTests/ShellShimRepositoryTests.cs b/test/dotnet.Tests/ShellShimTests/ShellShimRepositoryTests.cs
index facb4cda8184..b13fac54095e 100644
--- a/test/dotnet.Tests/ShellShimTests/ShellShimRepositoryTests.cs
+++ b/test/dotnet.Tests/ShellShimTests/ShellShimRepositoryTests.cs
@@ -471,12 +471,12 @@ private string ExecuteInShell(string shellCommandName, string cleanFolderUnderTe
if (Environment.Is64BitProcess)
{
processStartInfo.EnvironmentVariables["DOTNET_ROOT"] =
- TestContext.Current.ToolsetUnderTest.DotNetRoot;
+ SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
}
else
{
processStartInfo.EnvironmentVariables["DOTNET_ROOT(x86)"] =
- TestContext.Current.ToolsetUnderTest.DotNetRoot;
+ SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
}
processStartInfo.ExecuteAndCaptureOutput(out var stdOut, out var stdErr);
@@ -489,7 +489,7 @@ private string ExecuteInShell(string shellCommandName, string cleanFolderUnderTe
private static string GetAppHostTemplateFromStage2()
{
var stage2AppHostTemplateDirectory =
- Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "AppHostTemplate");
+ Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "AppHostTemplate");
return stage2AppHostTemplateDirectory;
}
diff --git a/test/dotnet.Tests/TestAssetExtensions.cs b/test/dotnet.Tests/TestAssetExtensions.cs
index 9482e65e09b1..51a266321dc2 100644
--- a/test/dotnet.Tests/TestAssetExtensions.cs
+++ b/test/dotnet.Tests/TestAssetExtensions.cs
@@ -41,7 +41,7 @@ public static TestAsset WithRepoGlobalPackages(this TestAsset testAsset)
{
var ns = project.Root.Name.Namespace;
project.Root.Element(ns + "PropertyGroup")
- .Add(new XElement(ns + "RestorePackagesPath", TestContext.Current.TestGlobalPackagesFolder));
+ .Add(new XElement(ns + "RestorePackagesPath", SdkTestContext.Current.TestGlobalPackagesFolder));
});
}
}
diff --git a/test/trustedroots.Tests/CtlFileTests.cs b/test/trustedroots.Tests/CtlFileTests.cs
index 6d24a2a3e50e..4422078d54e9 100644
--- a/test/trustedroots.Tests/CtlFileTests.cs
+++ b/test/trustedroots.Tests/CtlFileTests.cs
@@ -13,7 +13,7 @@ public abstract class CtlFileTests
public CtlFileTests(string fileName)
{
_filePath = Path.Combine(
- TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest,
+ SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest,
"trustedroots",
fileName);
}