Remove unused test project and fixture settings (dotnet/core-setup#5332)
authorVitek Karas <vitek.karas@microsoft.com>
Tue, 5 Mar 2019 16:36:28 +0000 (08:36 -0800)
committerGitHub <noreply@github.com>
Tue, 5 Mar 2019 16:36:28 +0000 (08:36 -0800)
Simplify computation of platform specific file names.
Remove unnecessary private fields.
Remove unnecessary methods.

Commit migrated from https://github.com/dotnet/core-setup/commit/a8a3922bed6ab591c777ead9aeb14dbc6e21dae3

src/installer/test/HostActivationTests/GivenThatICareAboutComponentDependencyResolution.cs
src/installer/test/HostActivationTests/GivenThatICareAboutMultilevelSharedFxLookup.DepsVersion.cs
src/installer/test/HostActivationTests/GivenThatICareAboutMultilevelSharedFxLookup.cs
src/installer/test/HostActivationTests/GivenThatICareAboutNativeHostApis.cs
src/installer/test/HostActivationTests/GivenThatICareAboutSharedFxLookup.cs
src/installer/test/HostActivationTests/GivenThatICareAboutStandaloneAppActivation.cs
src/installer/test/TestUtils/DotNetCli.cs
src/installer/test/TestUtils/RuntimeInformationExtensions.cs
src/installer/test/TestUtils/TestProject.cs
src/installer/test/TestUtils/TestProjectFixture.cs

index 64ce90c..ed296eb 100644 (file)
@@ -481,7 +481,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHostApis
                     var fixture = PreviouslyPublishedAndRestoredPortableApiTestProjectFixture;
                     var hostpolicy = Path.Combine(
                         fixture.BuiltDotnet.GreatestVersionSharedFxPath,
-                        $"{fixture.SharedLibraryPrefix}hostpolicy{fixture.SharedLibraryExtension}");
+                        RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostpolicy"));
 
                     File.Copy(
                         hostpolicy,
index 6bbe939..ffde0ed 100644 (file)
@@ -1,5 +1,4 @@
-using Microsoft.DotNet.InternalAbstractions;
-using Microsoft.DotNet.Cli.Build.Framework;
+using Microsoft.DotNet.Cli.Build.Framework;
 using Newtonsoft.Json.Linq;
 using System;
 using System.IO;
index dd6c1f0..cfc7cf7 100644 (file)
@@ -25,7 +25,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHostApis
             var dotnet = fixture.BuiltDotnet;
             var appDll = fixture.TestProject.AppDll;
 
-            var dotnetLocation = Path.Combine(dotnet.BinPath, $"dotnet{fixture.ExeExtension}");
+            var dotnetLocation = dotnet.DotnetExecutablePath;
             string[] args =
             {
                 "hostfxr_get_native_search_directories",
@@ -76,7 +76,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHostApis
                 appFixture.TestProject.DepsJson,
                 File.ReadAllLines(appFixture.TestProject.DepsJson) + "}");
 
-            var dotnetLocation = Path.Combine(dotnet.BinPath, $"dotnet{fixture.ExeExtension}");
+            var dotnetLocation = dotnet.DotnetExecutablePath;
             string[] args =
             {
                 "hostfxr_get_native_search_directories",
@@ -388,8 +388,8 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHostApis
                     // On non-Windows, we can't just P/Invoke to already loaded hostfxr, so copy it next to the app dll.
                     var fixture = PreviouslyPublishedAndRestoredPortableApiTestProjectFixture;
                     var hostfxr = Path.Combine(
-                        fixture.BuiltDotnet.GreatestVersionHostFxrPath, 
-                        $"{fixture.SharedLibraryPrefix}hostfxr{fixture.SharedLibraryExtension}");
+                        fixture.BuiltDotnet.GreatestVersionHostFxrPath,
+                        RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostfxr"));
 
                     File.Copy(
                         hostfxr, 
index 9958e65..fd6cbb1 100644 (file)
@@ -4,7 +4,6 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Runtime.InteropServices;
 using Xunit;
 
 namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.SharedFxLookup
@@ -1053,14 +1052,14 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.SharedFxLookup
                 .Values()["native"].Children().OfType<JProperty>();
 
             // Change the coreclr.dll asset to specify only "coreclr.dll" as the relative path (no directories).
-            string coreClrLibraryName = $"{fixture.SharedLibraryPrefix}coreclr{fixture.SharedLibraryExtension}";
+            string coreClrLibraryName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("coreclr");
             JProperty coreClrProperty = netCoreAppNativeAssets.First(p => p.Name.Contains(coreClrLibraryName));
             JProperty newCoreClrProperty = new JProperty(coreClrProperty.Name.Substring(coreClrProperty.Name.LastIndexOf('/') + 1), coreClrProperty.Value);
             coreClrProperty.Parent.Add(newCoreClrProperty);
             coreClrProperty.Remove();
 
             // Change the clrjit.dll asset to specify only "clrjit.dll" as the relative path (no directories).
-            string clrJitLibraryName = $"{fixture.SharedLibraryPrefix}clrjit{fixture.SharedLibraryExtension}";
+            string clrJitLibraryName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("clrjit");
             JProperty clrJitProperty = netCoreAppNativeAssets.First(p => p.Name.Contains(clrJitLibraryName));
             JProperty newClrJitProperty = new JProperty(clrJitProperty.Name.Substring(clrJitProperty.Name.LastIndexOf('/') + 1), clrJitProperty.Value);
             clrJitProperty.Parent.Add(newClrJitProperty);
index 9022705..05598da 100644 (file)
@@ -460,8 +460,8 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.StandaloneApp
                     throw new Exception("host or hostpolicy does not exist in test project output. Is this a standalone app?");
                 }
 
-                var dotnetHostPolicy = Path.Combine(dotnet.GreatestVersionSharedFxPath, $"{testProjectFixture.SharedLibraryPrefix}hostpolicy{testProjectFixture.SharedLibraryExtension}");
-                var dotnetHostFxr = Path.Combine(dotnet.GreatestVersionHostFxrPath, $"{testProjectFixture.SharedLibraryPrefix}hostfxr{testProjectFixture.SharedLibraryExtension}");
+                var dotnetHostPolicy = Path.Combine(dotnet.GreatestVersionSharedFxPath, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostpolicy"));
+                var dotnetHostFxr = Path.Combine(dotnet.GreatestVersionHostFxrPath, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostfxr"));
 
                 File.Copy(dotnetHostPolicy, testProjectHostPolicy, true);
 
index c7d1d81..a1e44e3 100644 (file)
@@ -1,23 +1,52 @@
-using System;
-using System.IO;
+using System.IO;
 using System.Linq;
-using System.Runtime.InteropServices;
 using Microsoft.DotNet.Cli.Build.Framework;
-using Microsoft.DotNet.InternalAbstractions;
-using System.Collections.Generic;
+using Microsoft.DotNet.CoreSetup.Test;
 
 namespace Microsoft.DotNet.Cli.Build
 {
     public partial class DotNetCli
     {
         public string BinPath { get; }
-        public string GreatestVersionSharedFxPath { get; private set; }
-        public string GreatestVersionHostFxrPath { get; private set; } 
+        public string GreatestVersionSharedFxPath { get; }
+        public string GreatestVersionHostFxrPath { get; } 
+        public string DotnetExecutablePath
+        {
+            get
+            {
+                return Path.Combine(BinPath, RuntimeInformationExtensions.GetExeFileNameForCurrentPlatform("dotnet"));
+            }
+        }
 
         public DotNetCli(string binPath)
         {
             BinPath = binPath;
-            ComputeSharedFxPaths();
+
+            var sharedFxBaseDirectory = Path.Combine(BinPath, "shared", "Microsoft.NETCore.App");
+            if (!Directory.Exists(sharedFxBaseDirectory))
+            {
+                GreatestVersionSharedFxPath = null;
+                return;
+            }
+
+            var hostFxrBaseDirectory = Path.Combine(BinPath, "host", "fxr");
+
+            if (!Directory.Exists(hostFxrBaseDirectory))
+            {
+                GreatestVersionHostFxrPath = null;
+                return;
+            }
+
+            var sharedFxVersionDirectories = Directory.EnumerateDirectories(sharedFxBaseDirectory);
+
+            GreatestVersionSharedFxPath = sharedFxVersionDirectories
+                .OrderByDescending(p => p.ToLower())
+                .First();
+
+            var hostFxrVersionDirectories = Directory.EnumerateDirectories(hostFxrBaseDirectory);
+            GreatestVersionHostFxrPath = hostFxrVersionDirectories
+                .OrderByDescending(p => p.ToLower())
+                .First();
         }
 
         public Command Exec(string command, params string[] args)
@@ -30,7 +59,7 @@ namespace Microsoft.DotNet.Cli.Build
                 newArgs.Insert(0, "-v");
             }
 
-            return Command.Create(Path.Combine(BinPath, $"dotnet{Constants.ExeSuffix}"), newArgs)
+            return Command.Create(DotnetExecutablePath, newArgs)
                 .EnvironmentVariable("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "1");
         }
 
@@ -41,35 +70,5 @@ namespace Microsoft.DotNet.Cli.Build
         public Command Publish(params string[] args) => Exec("publish", args);
 
         public Command Store(params string[] args) => Exec("store", args);
-
-        private void ComputeSharedFxPaths()
-        {
-            var sharedFxBaseDirectory = Path.Combine(BinPath, "shared", "Microsoft.NETCore.App");
-            if ( ! Directory.Exists(sharedFxBaseDirectory))
-            {
-                
-                GreatestVersionSharedFxPath = null;
-                return;
-            }
-
-            var hostFxrBaseDirectory = Path.Combine(BinPath, "host", "fxr"); 
-
-            if (!Directory.Exists(hostFxrBaseDirectory)) 
-            { 
-                GreatestVersionHostFxrPath = null; 
-                return; 
-            } 
-
-            var sharedFxVersionDirectories = Directory.EnumerateDirectories(sharedFxBaseDirectory);
-
-            GreatestVersionSharedFxPath = sharedFxVersionDirectories
-                .OrderByDescending(p => p.ToLower())
-                .First();
-            var hostFxrVersionDirectories = Directory.EnumerateDirectories(hostFxrBaseDirectory); 
-            GreatestVersionHostFxrPath = hostFxrVersionDirectories 
-                .OrderByDescending(p => p.ToLower()) 
-                .First();                 
-        }
     }
 }
index 2625017..bd227b7 100644 (file)
@@ -4,44 +4,31 @@ namespace Microsoft.DotNet.CoreSetup.Test
 {
     public static class RuntimeInformationExtensions
     {
-        public static string GetExeExtensionForCurrentOSPlatform()
-        {
-            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
-            {
-                return ".exe";
-            }
-            else
-            {
-                return "";
-            }
-        }
+        public static string GetExeFileNameForCurrentPlatform(string exeName) =>
+            exeName + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty);
 
-        public static string GetSharedLibraryExtensionForCurrentPlatform()
+        public static string GetSharedLibraryFileNameForCurrentPlatform(string libraryName)
         {
+            string prefix;
+            string suffix;
+
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             {
-                return ".dll";
+                prefix = string.Empty;
+                suffix = ".dll";
             }
             else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
             {
-                return ".dylib";
+                prefix = "lib";
+                suffix = ".dylib";
             }
             else
             {
-                return ".so";
+                prefix = "lib";
+                suffix = ".so";
             }
-        }
 
-        public static string GetSharedLibraryPrefixForCurrentPlatform()
-        {
-            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
-            {
-                return "";
-            }
-            else
-            {
-                return "lib";
-            }
+            return prefix + libraryName + suffix;
         }
     }
 }
index 2e31cbf..0b9af44 100644 (file)
@@ -1,66 +1,38 @@
 using System;
-using System.Collections.Generic;
 using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
 
 namespace Microsoft.DotNet.CoreSetup.Test
 {
     public class TestProject : IDisposable
     {
-        private string _projectDirectory;
-        private string _projectName;
-        private string _outputDirectory;
-        private string _exeExtension;
-        private string _sharedLibraryExtension;
-        private string _sharedLibraryPrefix;
+        public string ProjectDirectory { get; }
+        public string ProjectName { get; }
 
-        private string _projectFile;
-        private string _projectAssetsJson;
-        private string _runtimeConfigJson;
-        private string _runtimeDevConfigJson;
-        private string _depsJson;
-        private string _appDll;
-        private string _appExe;
-        private string _hostPolicyDll;
-        private string _hostFxrDll;
-        private string _assemblyName;
-
-        public string ProjectDirectory => _projectDirectory;
-        public string ProjectName => _projectName;
-
-        public string OutputDirectory { get { return _outputDirectory; } set { _outputDirectory = value; } }
-        public string ExeExtension { get { return _exeExtension; } set { _exeExtension = value; } }
-        public string AssemblyName { get { return _assemblyName; } set { _assemblyName = value; } }
-        public string ProjectFile { get { return _projectFile; } set { _projectFile = value; } }
-        public string ProjectAssetsJson { get { return _projectAssetsJson; } set { _projectAssetsJson = value; } }
-        public string RuntimeConfigJson { get { return _runtimeConfigJson; } set { _runtimeConfigJson = value; } }
-        public string RuntimeDevConfigJson { get { return _runtimeDevConfigJson; } set { _runtimeDevConfigJson = value; } }
-        public string DepsJson { get { return _depsJson; } set { _depsJson = value; } }
-        public string AppDll { get { return _appDll; } set { _appDll = value; } }
-        public string AppExe { get { return _appExe; } set { _appExe = value; } }
-        public string HostPolicyDll { get { return _hostPolicyDll; } set { _hostPolicyDll = value; } }
-        public string HostFxrDll { get { return _hostFxrDll; } set { _hostFxrDll = value; } }
+        public string OutputDirectory { get; set; }
+        public string AssemblyName { get; set; }
+        public string ProjectFile { get; set; }
+        public string ProjectAssetsJson { get; set; }
+        public string RuntimeConfigJson { get; set; }
+        public string RuntimeDevConfigJson { get; set; }
+        public string DepsJson { get; set; }
+        public string AppDll { get; set; }
+        public string AppExe { get; set; }
+        public string HostPolicyDll { get; set; }
+        public string HostFxrDll { get; set; }
 
         public TestProject(
             string projectDirectory,
-            string exeExtension,
-            string sharedLibraryExtension,
-            string sharedLibraryPrefix,
             string outputDirectory = null,
             string assemblyName = null)
         {
-            _projectDirectory = projectDirectory;
-            _exeExtension = exeExtension;
-            _sharedLibraryExtension = sharedLibraryExtension;
-            _sharedLibraryPrefix = sharedLibraryPrefix;
-            _projectName = Path.GetFileName(_projectDirectory);
-            _assemblyName = assemblyName ?? _projectName;
-            _projectFile = Path.Combine(_projectDirectory, $"{_projectName}.csproj");
-            _projectAssetsJson = Path.Combine(_projectDirectory, "obj", "project.assets.json");
+            ProjectDirectory = projectDirectory;
+            ProjectName = Path.GetFileName(ProjectDirectory);
+            AssemblyName = assemblyName ?? ProjectName;
+            ProjectFile = Path.Combine(ProjectDirectory, $"{ProjectName}.csproj");
+            ProjectAssetsJson = Path.Combine(ProjectDirectory, "obj", "project.assets.json");
 
-            _outputDirectory = outputDirectory ?? Path.Combine(_projectDirectory, "bin");
-            if (Directory.Exists(_outputDirectory))
+            OutputDirectory = outputDirectory ?? Path.Combine(ProjectDirectory, "bin");
+            if (Directory.Exists(OutputDirectory))
             {
                 LoadOutputFiles();
             }
@@ -70,34 +42,34 @@ namespace Microsoft.DotNet.CoreSetup.Test
         {
             if (!PreserveTestRuns())
             {
-                Directory.Delete(_projectDirectory, true);
+                Directory.Delete(ProjectDirectory, true);
             }
         }
 
         public void CopyProjectFiles(string directory)
         {
-            CopyRecursive(_projectDirectory, directory, overwrite: true);
+            CopyRecursive(ProjectDirectory, directory, overwrite: true);
         }
 
         public void LoadOutputFiles()
         {
-            _appDll = Path.Combine(_outputDirectory, $"{_assemblyName}.dll");
-            _appExe = Path.Combine(_outputDirectory, $"{_assemblyName}{_exeExtension}");
-            _depsJson = Path.Combine(_outputDirectory, $"{_assemblyName}.deps.json");
-            _runtimeConfigJson = Path.Combine(_outputDirectory, $"{_assemblyName}.runtimeconfig.json");
-            _runtimeDevConfigJson = Path.Combine(_outputDirectory, $"{_assemblyName}.runtimeconfig.dev.json");
-            _hostPolicyDll = Path.Combine(_outputDirectory, $"{_sharedLibraryPrefix}hostpolicy{_sharedLibraryExtension}");
-            _hostFxrDll = Path.Combine(_outputDirectory, $"{_sharedLibraryPrefix}hostfxr{_sharedLibraryExtension}");
+            AppDll = Path.Combine(OutputDirectory, $"{AssemblyName}.dll");
+            AppExe = Path.Combine(OutputDirectory, RuntimeInformationExtensions.GetExeFileNameForCurrentPlatform(AssemblyName));
+            DepsJson = Path.Combine(OutputDirectory, $"{AssemblyName}.deps.json");
+            RuntimeConfigJson = Path.Combine(OutputDirectory, $"{AssemblyName}.runtimeconfig.json");
+            RuntimeDevConfigJson = Path.Combine(OutputDirectory, $"{AssemblyName}.runtimeconfig.dev.json");
+            HostPolicyDll = Path.Combine(OutputDirectory, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostpolicy"));
+            HostFxrDll = Path.Combine(OutputDirectory, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostfxr"));
         }
 
         public bool IsRestored()
         {
-            if (string.IsNullOrEmpty(_projectAssetsJson))
+            if (string.IsNullOrEmpty(ProjectAssetsJson))
             {
                 return false;
             }
 
-            return File.Exists(_projectAssetsJson);
+            return File.Exists(ProjectAssetsJson);
         }
 
         private void CopyRecursive(string sourceDirectory, string destinationDirectory, bool overwrite = false)
index ecad2f6..c74ab68 100644 (file)
@@ -15,118 +15,78 @@ namespace Microsoft.DotNet.CoreSetup.Test
     {
         private static readonly string s_testArtifactDirectoryEnvironmentVariable = "TEST_ARTIFACTS";
 
-        private string _testProjectName;
-        private string _exeExtension;
-        private string _sharedLibraryExtension;
-        private string _sharedLibraryPrefix;
-        private string _testProjectSourceDirectory;
         private string _testArtifactDirectory;
-        private string _currentRid;
-        private string _framework;
         private string _assemblyName;
-
-        private RepoDirectoriesProvider _repoDirectoriesProvider;
-
-        private DotNetCli _sdkDotnet;
-        private DotNetCli _builtDotnet;
-
         private TestProject _sourceTestProject;
-        private TestProject _testProject;
         private List<TestProject> _copiedTestProjects = new List<TestProject>();
 
-        public DotNetCli SdkDotnet => _sdkDotnet;
-        public DotNetCli BuiltDotnet => _builtDotnet;
-        public TestProject TestProject => _testProject;
+        public DotNetCli SdkDotnet { get; }
+        public DotNetCli BuiltDotnet { get; }
+        public TestProject TestProject { get; private set; }
+
+        public string CurrentRid { get; private set; }
+        public string Framework { get; private set; }
+        public RepoDirectoriesProvider RepoDirProvider { get; }
 
-        public string CurrentRid => _currentRid;
-        public string ExeExtension => _exeExtension;
-        public string SharedLibraryExtension => _sharedLibraryExtension;
-        public string SharedLibraryPrefix => _sharedLibraryPrefix;
-        public string Framework => _framework;
-        public RepoDirectoriesProvider RepoDirProvider  => _repoDirectoriesProvider;
         public TestProjectFixture(
             string testProjectName,
             RepoDirectoriesProvider repoDirectoriesProvider,
-            string exeExtension = null,
-            string sharedLibraryExtension = null,
-            string sharedLibraryPrefix= null,
-            string testProjectSourceDirectory = null,
-            string testArtifactDirectory = null,
-            string dotnetInstallPath = null,
-            string currentRid = null,
-            string builtDotnetOutputPath = null,
             string framework = null,
             string assemblyName = null)
         {
             ValidateRequiredDirectories(repoDirectoriesProvider);
 
-            _testProjectName = testProjectName;
-            _framework = framework ?? Environment.GetEnvironmentVariable("MNA_TFM");
-
-            _exeExtension = exeExtension ?? RuntimeInformationExtensions.GetExeExtensionForCurrentOSPlatform();
-            _sharedLibraryExtension = sharedLibraryExtension
-                ?? RuntimeInformationExtensions.GetSharedLibraryExtensionForCurrentPlatform();
-            _sharedLibraryPrefix = sharedLibraryPrefix
-                ?? RuntimeInformationExtensions.GetSharedLibraryPrefixForCurrentPlatform();
+            Framework = framework ?? Environment.GetEnvironmentVariable("MNA_TFM");
 
-            _repoDirectoriesProvider = repoDirectoriesProvider;
+            RepoDirProvider = repoDirectoriesProvider;
 
-            _testProjectSourceDirectory = testProjectSourceDirectory
-                ?? Path.Combine(repoDirectoriesProvider.RepoRoot, "src", "test", "Assets", "TestProjects");
             _testArtifactDirectory = _testArtifactDirectory
                 ?? Environment.GetEnvironmentVariable(s_testArtifactDirectoryEnvironmentVariable)
                 ?? Path.Combine(AppContext.BaseDirectory, s_testArtifactDirectoryEnvironmentVariable);
 
-            _sdkDotnet = new DotNetCli(dotnetInstallPath ?? repoDirectoriesProvider.DotnetSDK);
-            _currentRid = currentRid ?? repoDirectoriesProvider.TargetRID;
+            SdkDotnet = new DotNetCli(repoDirectoriesProvider.DotnetSDK);
+            CurrentRid = repoDirectoriesProvider.TargetRID;
 
-            _builtDotnet = new DotNetCli(repoDirectoriesProvider.BuiltDotnet);
+            BuiltDotnet = new DotNetCli(repoDirectoriesProvider.BuiltDotnet);
 
             _assemblyName = assemblyName;
 
-            InitializeTestProject(
-                _testProjectName,
-                _testProjectSourceDirectory,
+            var sourceTestProjectPath = Path.Combine(repoDirectoriesProvider.RepoRoot, "src", "test", "Assets", "TestProjects", testProjectName);
+            _sourceTestProject = new TestProject(
+                sourceTestProjectPath,
+                assemblyName: _assemblyName);
+
+            TestProject = CopyTestProject(
+                _sourceTestProject,
                 _testArtifactDirectory,
-                _exeExtension,
-                _sharedLibraryExtension,
-                _sharedLibraryPrefix,
                 _assemblyName);
         }
 
         public TestProjectFixture(TestProjectFixture fixtureToCopy)
         {
-            _testProjectName = fixtureToCopy._testProjectName;
-            _exeExtension = fixtureToCopy._exeExtension;
-            _sharedLibraryExtension = fixtureToCopy._sharedLibraryExtension;
-            _sharedLibraryPrefix = fixtureToCopy._sharedLibraryPrefix;
-            _repoDirectoriesProvider = fixtureToCopy._repoDirectoriesProvider;
-            _testProjectSourceDirectory = fixtureToCopy._testProjectSourceDirectory;
+            RepoDirProvider = fixtureToCopy.RepoDirProvider;
             _testArtifactDirectory = fixtureToCopy._testArtifactDirectory;
-            _sdkDotnet = fixtureToCopy._sdkDotnet;
-            _currentRid = fixtureToCopy._currentRid;
-            _builtDotnet = fixtureToCopy._builtDotnet;
+            SdkDotnet = fixtureToCopy.SdkDotnet;
+            CurrentRid = fixtureToCopy.CurrentRid;
+            BuiltDotnet = fixtureToCopy.BuiltDotnet;
             _sourceTestProject = fixtureToCopy._sourceTestProject;
-            _framework = fixtureToCopy._framework;
+            Framework = fixtureToCopy.Framework;
             _assemblyName = fixtureToCopy._assemblyName;
 
-            _testProject = CopyTestProject(
+            TestProject = CopyTestProject(
                 fixtureToCopy.TestProject,
                 _testArtifactDirectory,
-                _exeExtension,
-                _sharedLibraryExtension,
-                _sharedLibraryPrefix,
                 _assemblyName);
 
-            fixtureToCopy._copiedTestProjects.Add(_testProject);
+            fixtureToCopy._copiedTestProjects.Add(TestProject);
         }
 
         public void Dispose()
         {
-            if (_testProject != null)
+            if (TestProject != null)
             {
-                _testProject.Dispose();
-                _testProject = null;
+                TestProject.Dispose();
+                TestProject = null;
             }
 
             foreach (var project in _copiedTestProjects)
@@ -137,38 +97,9 @@ namespace Microsoft.DotNet.CoreSetup.Test
             _copiedTestProjects.Clear();
         }
 
-        private void InitializeTestProject(
-            string testProjectName,
-            string testProjectSourceDirectory,
-            string testArtifactDirectory,
-            string exeExtension,
-            string sharedLibraryExtension,
-            string sharedLibraryPrefix,
-            string assemblyName)
-        {
-            var sourceTestProjectPath = Path.Combine(testProjectSourceDirectory, testProjectName);
-            _sourceTestProject = new TestProject(
-                sourceTestProjectPath,
-                exeExtension,
-                sharedLibraryExtension,
-                sharedLibraryPrefix,
-                assemblyName: assemblyName);
-
-            _testProject = CopyTestProject(
-                _sourceTestProject,
-                testArtifactDirectory,
-                exeExtension,
-                sharedLibraryExtension,
-                sharedLibraryPrefix,
-                assemblyName);
-        }
-
         private TestProject CopyTestProject(
             TestProject sourceTestProject,
             string testArtifactDirectory,
-            string exeExtension,
-            string sharedLibraryExtension,
-            string sharedLibraryPrefix,
             string assemblyName)
         {
             string copiedTestProjectDirectory = CalculateTestProjectDirectory(
@@ -181,9 +112,6 @@ namespace Microsoft.DotNet.CoreSetup.Test
 
             return new TestProject(
                 copiedTestProjectDirectory,
-                exeExtension,
-                sharedLibraryExtension,
-                sharedLibraryPrefix,
                 assemblyName: assemblyName);
         }
 
@@ -243,14 +171,16 @@ namespace Microsoft.DotNet.CoreSetup.Test
             string framework = null,
             string outputDirectory = null)
         {
-            dotnet = dotnet ?? _sdkDotnet;
-            outputDirectory = outputDirectory ?? _testProject.OutputDirectory;
-            _testProject.OutputDirectory = outputDirectory;
-            framework = framework ?? _framework;
-            _framework = framework;
+            dotnet = dotnet ?? SdkDotnet;
+            outputDirectory = outputDirectory ?? TestProject.OutputDirectory;
+            TestProject.OutputDirectory = outputDirectory;
+            framework = framework ?? Framework;
+            Framework = framework;
 
-            var buildArgs = new List<string>();
-            buildArgs.Add("--no-restore");
+            var buildArgs = new List<string>
+            {
+                "--no-restore"
+            };
 
             if (runtime != null)
             {
@@ -264,7 +194,7 @@ namespace Microsoft.DotNet.CoreSetup.Test
                 buildArgs.Add(framework);
             }
 
-            buildArgs.Add($"/p:MNAVersion={_repoDirectoriesProvider.MicrosoftNETCoreAppVersion}");
+            buildArgs.Add($"/p:MNAVersion={RepoDirProvider.MicrosoftNETCoreAppVersion}");
 
             if (outputDirectory != null)
             {
@@ -273,15 +203,15 @@ namespace Microsoft.DotNet.CoreSetup.Test
             }
 
             dotnet.Build(buildArgs.ToArray())
-                .WorkingDirectory(_testProject.ProjectDirectory)
-                .Environment("NUGET_PACKAGES", _repoDirectoriesProvider.NugetPackages)
+                .WorkingDirectory(TestProject.ProjectDirectory)
+                .Environment("NUGET_PACKAGES", RepoDirProvider.NugetPackages)
                 .Environment("VERSION", "") // Generate with package version 1.0.0, not %VERSION%
                 .CaptureStdErr()
                 .CaptureStdOut()
                 .Execute()
                 .EnsureSuccessful();
 
-            _testProject.LoadOutputFiles();
+            TestProject.LoadOutputFiles();
 
             return this;
         }
@@ -293,13 +223,16 @@ namespace Microsoft.DotNet.CoreSetup.Test
             string manifest = null,
             string outputDirectory = null)
         {
-            dotnet = dotnet ?? _sdkDotnet;
-            outputDirectory = outputDirectory ?? _testProject.OutputDirectory;
-            framework = framework ?? _framework;
-            _framework = framework;
+            dotnet = dotnet ?? SdkDotnet;
+            outputDirectory = outputDirectory ?? TestProject.OutputDirectory;
+            framework = framework ?? Framework;
+            Framework = framework;
+
+            var storeArgs = new List<string>
+            {
+                "--runtime"
+            };
 
-            var storeArgs = new List<string>();
-            storeArgs.Add("--runtime");
             if (runtime != null)
             {
                 storeArgs.Add(runtime);
@@ -331,21 +264,21 @@ namespace Microsoft.DotNet.CoreSetup.Test
                 storeArgs.Add(outputDirectory);
             }
 
-            storeArgs.Add($"/p:MNAVersion={_repoDirectoriesProvider.MicrosoftNETCoreAppVersion}");
-            storeArgs.Add($"/p:NETCoreAppFramework={_framework}");
+            storeArgs.Add($"/p:MNAVersion={RepoDirProvider.MicrosoftNETCoreAppVersion}");
+            storeArgs.Add($"/p:NETCoreAppFramework={Framework}");
 
             // Ensure the project's OutputType isn't 'Exe', since that causes issues with 'dotnet store'
             storeArgs.Add("/p:OutputType=Library");
 
             dotnet.Store(storeArgs.ToArray())
-                .WorkingDirectory(_testProject.ProjectDirectory)
-                .Environment("NUGET_PACKAGES", _repoDirectoriesProvider.NugetPackages)
+                .WorkingDirectory(TestProject.ProjectDirectory)
+                .Environment("NUGET_PACKAGES", RepoDirProvider.NugetPackages)
                 .CaptureStdErr()
                 .CaptureStdOut()
                 .Execute()
                 .EnsureSuccessful();
 
-            _testProject.LoadOutputFiles();
+            TestProject.LoadOutputFiles();
 
             return this;
         }
@@ -356,14 +289,16 @@ namespace Microsoft.DotNet.CoreSetup.Test
             string framework = null,
             string outputDirectory = null)
         {
-            dotnet = dotnet ?? _sdkDotnet;
-            outputDirectory = outputDirectory ?? _testProject.OutputDirectory;
-            _testProject.OutputDirectory = outputDirectory;
-            framework = framework ?? _framework;
-            _framework = framework;
+            dotnet = dotnet ?? SdkDotnet;
+            outputDirectory = outputDirectory ?? TestProject.OutputDirectory;
+            TestProject.OutputDirectory = outputDirectory;
+            framework = framework ?? Framework;
+            Framework = framework;
 
-            var publishArgs = new List<string>();
-            publishArgs.Add("--no-restore");
+            var publishArgs = new List<string>
+            {
+                "--no-restore"
+            };
 
             if (runtime != null)
             {
@@ -384,17 +319,17 @@ namespace Microsoft.DotNet.CoreSetup.Test
                 publishArgs.Add(outputDirectory);
             }
 
-            publishArgs.Add($"/p:MNAVersion={_repoDirectoriesProvider.MicrosoftNETCoreAppVersion}");
+            publishArgs.Add($"/p:MNAVersion={RepoDirProvider.MicrosoftNETCoreAppVersion}");
 
             dotnet.Publish(publishArgs.ToArray())
-                .WorkingDirectory(_testProject.ProjectDirectory)
-                .Environment("NUGET_PACKAGES", _repoDirectoriesProvider.NugetPackages)
+                .WorkingDirectory(TestProject.ProjectDirectory)
+                .Environment("NUGET_PACKAGES", RepoDirProvider.NugetPackages)
                 .CaptureStdErr()
                 .CaptureStdOut()
                 .Execute()
                 .EnsureSuccessful();
 
-            _testProject.LoadOutputFiles();
+            TestProject.LoadOutputFiles();
 
             return this;
         }
@@ -409,19 +344,19 @@ namespace Microsoft.DotNet.CoreSetup.Test
             }
             restoreArgs.Add("--disable-parallel");
 
-            restoreArgs.Add($"/p:MNAVersion={_repoDirectoriesProvider.MicrosoftNETCoreAppVersion}");
-            restoreArgs.Add($"/p:NETCoreAppFramework={_framework}");
+            restoreArgs.Add($"/p:MNAVersion={RepoDirProvider.MicrosoftNETCoreAppVersion}");
+            restoreArgs.Add($"/p:NETCoreAppFramework={Framework}");
 
             if (extraMSBuildProperties != null)
             {
                 restoreArgs.Add(extraMSBuildProperties);
             }
 
-            _sdkDotnet.Restore(restoreArgs.ToArray())
-                .WorkingDirectory(_testProject.ProjectDirectory)
+            SdkDotnet.Restore(restoreArgs.ToArray())
+                .WorkingDirectory(TestProject.ProjectDirectory)
                 .CaptureStdErr()
                 .CaptureStdOut()
-                .Environment("NUGET_PACKAGES", _repoDirectoriesProvider.NugetPackages)
+                .Environment("NUGET_PACKAGES", RepoDirProvider.NugetPackages)
                 .Execute()
                 .EnsureSuccessful();
 
@@ -430,7 +365,7 @@ namespace Microsoft.DotNet.CoreSetup.Test
 
         public TestProjectFixture EnsureRestored(params string[] fallbackSources)
         {
-            if ( ! _testProject.IsRestored())
+            if ( ! TestProject.IsRestored())
             {
                 RestoreProject(fallbackSources);
             }
@@ -440,7 +375,7 @@ namespace Microsoft.DotNet.CoreSetup.Test
 
         public TestProjectFixture EnsureRestoredForRid(string rid, params string[] fallbackSources)
         {
-            if ( ! _testProject.IsRestored())
+            if ( ! TestProject.IsRestored())
             {
                 string extraMSBuildProperties = $"/p:TestTargetRid={rid}";
                 RestoreProject(fallbackSources, extraMSBuildProperties);