Exemplo n.º 1
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                PreviouslyPublishedAndRestoredPortableApiTestProjectFixture = new TestProjectFixture("HostApiInvokerApp", RepoDirectories)
                                                                              .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                              .BuildProject();

                PreviouslyPublishedAndRestoredComponentWithNoDependenciesFixture = new TestProjectFixture("ComponentWithNoDependencies", RepoDirectories)
                                                                                   .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                                   .PublishProject();

                PreviouslyPublishedAndRestoredComponentWithDependenciesFixture = new TestProjectFixture("ComponentWithDependencies", RepoDirectories)
                                                                                 .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                                 .PublishProject();

                PreviouslyPublishedAndRestoredComponentWithResourcesFixture = new TestProjectFixture("ComponentWithResources", RepoDirectories)
                                                                              .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                              .PublishProject();

                if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    // On non-Windows, we can't just P/Invoke to already loaded hostpolicy, so copy it next to the app dll.
                    var fixture    = PreviouslyPublishedAndRestoredPortableApiTestProjectFixture;
                    var hostpolicy = Path.Combine(
                        fixture.BuiltDotnet.GreatestVersionSharedFxPath,
                        $"{fixture.SharedLibraryPrefix}hostpolicy{fixture.SharedLibraryExtension}");

                    File.Copy(
                        hostpolicy,
                        Path.GetDirectoryName(fixture.TestProject.AppDll));
                }
            }
Exemplo n.º 2
0
        public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
        {
            var repoDirectoriesProvider = new RepoDirectoriesProvider();
            var testAppName             = "MSBuildTestAppWithToolInDependencies";
            var testInstance            = TestAssetsManager
                                          .CreateTestInstance(testAppName);

            var configuration = "Debug";

            var testProjectDirectory = testInstance.TestRoot;

            new Restore3Command()
            .WithWorkingDirectory(testProjectDirectory)
            .Execute($"-s {repoDirectoriesProvider.TestPackages}")
            .Should()
            .Pass();

            new Build3Command()
            .WithWorkingDirectory(testProjectDirectory)
            .Execute($"-c {configuration}")
            .Should()
            .Pass();

            new DotnetCommand()
            .WithWorkingDirectory(testProjectDirectory)
            .ExecuteWithCapturedOutput(
                $"-v dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable")
            .Should()
            .Pass()
            .And
            .HaveStdOutContaining("Hello Portable World!");;
        }
Exemplo n.º 3
0
        public GivenThatICareAboutLightupAppActivation(GivenThatICareAboutLightupAppActivation.SharedTestState fixture)
        {
            sharedTestState = fixture;

            // From the artifacts dir, it's possible to find where the sharedFrameworkPublish folder is. We need
            // to locate it because we'll copy its contents into other folders
            string artifactsDir = Environment.GetEnvironmentVariable("TEST_ARTIFACTS");

            _builtDotnet = Path.Combine(artifactsDir, "sharedFrameworkPublish");

            // The dotnetLightupSharedFxLookup dir will contain some folders and files that will be necessary to perform the tests
            string sharedLookupDir = Path.Combine(artifactsDir, "dotnetLightupSharedFxLookup");

            _currentWorkingDir = SharedFramework.CalculateUniqueTestDirectory(sharedLookupDir);
            _fxBaseDir         = Path.Combine(_currentWorkingDir, "shared", "Microsoft.NETCore.App");
            _uberFxBaseDir     = Path.Combine(_currentWorkingDir, "shared", "Microsoft.UberFramework");

            SharedFramework.CopyDirectory(_builtDotnet, _currentWorkingDir);

            var repoDirectories = new RepoDirectoriesProvider(builtDotnet: _currentWorkingDir);

            PreviouslyGlobalBuiltAndRestoredLightupAppTestProjectFixture = new TestProjectFixture("LightupClient", repoDirectories)
                                                                           .EnsureRestored(sharedTestState.RepoDirectories.CorehostPackages)
                                                                           .BuildProject();

            string greatestVersionSharedFxPath = sharedTestState.PreviouslyBuiltAndRestoredLightupLibTestProjectFixture.BuiltDotnet.GreatestVersionSharedFxPath;
            string sharedFxVersion             = (new DirectoryInfo(greatestVersionSharedFxPath)).Name;

            _builtSharedFxDir     = Path.Combine(_builtDotnet, "shared", "Microsoft.NETCore.App", sharedFxVersion);
            _builtSharedUberFxDir = Path.Combine(_builtDotnet, "shared", "Microsoft.UberFramework", sharedFxVersion);
            SharedFramework.CreateUberFrameworkArtifacts(_builtSharedFxDir, _builtSharedUberFxDir, SystemCollectionsImmutableAssemblyVersion, SystemCollectionsImmutableFileVersion);
        }
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                var localizedFixture = new TestProjectFixture("LocalizedApp", RepoDirectories);

                localizedFixture
                .EnsureRestoredForRid(localizedFixture.CurrentRid)
                .PublishProject(runtime: localizedFixture.CurrentRid);

                var publishFixture = new TestProjectFixture("StandaloneApp", RepoDirectories);

                publishFixture
                .EnsureRestoredForRid(publishFixture.CurrentRid)
                .PublishProject(runtime: publishFixture.CurrentRid);

                var fwPublishedFixture = new TestProjectFixture("PortableApp", RepoDirectories);

                fwPublishedFixture
                .EnsureRestored()
                .PublishProject();

                StandaloneAppFixture_Localized         = localizedFixture;
                StandaloneAppFixture_Published         = publishFixture;
                FrameworkDependentAppFixture_Published = fwPublishedFixture;
            }
Exemplo n.º 5
0
            public SharedTestState()
            {
                BaseDirectory = SharedFramework.CalculateUniqueTestDirectory(Path.Combine(TestArtifact.TestArtifactsPath, "nativeHosting"));
                Directory.CreateDirectory(BaseDirectory);

                string nativeHostName = RuntimeInformationExtensions.GetExeFileNameForCurrentPlatform("nativehost");

                NativeHostPath = Path.Combine(BaseDirectory, nativeHostName);

                // Copy over native host and nethost
                RepoDirectories = new RepoDirectoriesProvider();
                string nethostName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("nethost");

                File.Copy(Path.Combine(RepoDirectories.CorehostPackages, nethostName), Path.Combine(BaseDirectory, nethostName));
                File.Copy(Path.Combine(RepoDirectories.Artifacts, "corehost_test", nativeHostName), NativeHostPath);

                InvalidInstallRoot = Path.Combine(BaseDirectory, "invalid");
                Directory.CreateDirectory(InvalidInstallRoot);

                ValidInstallRoot = Path.Combine(BaseDirectory, "valid");
                HostFxrPath      = CreateHostFxr(Path.Combine(ValidInstallRoot, "dotnet"));

                string appDir = Path.Combine(BaseDirectory, "app");

                Directory.CreateDirectory(appDir);
                string assemblyPath = Path.Combine(appDir, "App.dll");

                File.WriteAllText(assemblyPath, string.Empty);
                TestAssemblyPath = assemblyPath;
            }
Exemplo n.º 6
0
        public SharedTestStateBase()
        {
            BaseDirectory    = SharedFramework.CalculateUniqueTestDirectory(Path.Combine(TestArtifact.TestArtifactsPath, "nativeHosting"));
            _baseDirArtifact = new TestArtifact(BaseDirectory);
            Directory.CreateDirectory(BaseDirectory);

            string nativeHostName = RuntimeInformationExtensions.GetExeFileNameForCurrentPlatform("nativehost");

            NativeHostPath = Path.Combine(BaseDirectory, nativeHostName);

            // Copy over native host
            RepoDirectories = new RepoDirectoriesProvider();
            File.Copy(Path.Combine(RepoDirectories.Artifacts, "corehost_test", nativeHostName), NativeHostPath);

            // Copy nethost next to native host
            // This is done even for tests not directly using nethost because nativehost consumes nethost in the more
            // user-friendly way of linking against nethost (instead of dlopen/LoadLibrary and dlsym/GetProcAddress).
            // On Windows, we can delay load through a linker option, but on other platforms load is required on start.
            string nethostName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("nethost");

            NethostPath = Path.Combine(Path.GetDirectoryName(NativeHostPath), nethostName);
            File.Copy(
                Path.Combine(RepoDirectories.HostArtifacts, nethostName),
                NethostPath);
        }
        public static NuGetArtifactTester OpenOrNull(
            RepoDirectoriesProvider dirs,
            string project,
            string id = null)
        {
            id = id ?? project;

            string nuspecPath = Path.Combine(
                dirs.BaseArtifactsFolder,
                "packages",
                dirs.Configuration,
                "specs",
                $"{id}.nuspec");

            if (!File.Exists(nuspecPath))
            {
                return(null);
            }

            PackageIdentity builtIdentity = new NuspecReader(nuspecPath).GetIdentity();

            string nupkgPath = Path.Combine(
                dirs.BaseArtifactsFolder,
                "packages",
                dirs.Configuration,
                "Shipping",
                $"{builtIdentity}.nupkg");

            // If the nuspec exists, the nupkg should exist.
            Assert.True(File.Exists(nupkgPath));

            return(new NuGetArtifactTester(nupkgPath));
        }
Exemplo n.º 8
0
        public SDKLookup()
        {
            // The dotnetSDKLookup dir will contain some folders and files that will be
            // necessary to perform the tests
            string baseDir = Path.Combine(TestArtifact.TestArtifactsPath, "dotnetSDKLookup");

            _baseDir = SharedFramework.CalculateUniqueTestDirectory(baseDir);

            // The three tested locations will be the cwd, the user folder and the exe dir. cwd and user are no longer supported.
            //     All dirs will be placed inside the base folder
            _currentWorkingDir = Path.Combine(_baseDir, "cwd");
            _userDir           = Path.Combine(_baseDir, "user");
            _executableDir     = Path.Combine(_baseDir, "exe");

            DotNet = new DotNetBuilder(_baseDir, Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"), "exe")
                     .AddMicrosoftNETCoreAppFramework("9999.0.0")
                     .Build();

            RepoDirectories = new RepoDirectoriesProvider(builtDotnet: DotNet.BinPath);

            // SdkBaseDirs contain all available version folders
            _cwdSdkBaseDir  = Path.Combine(_currentWorkingDir, "sdk");
            _userSdkBaseDir = Path.Combine(_userDir, ".dotnet", RepoDirectories.BuildArchitecture, "sdk");
            _exeSdkBaseDir  = Path.Combine(_executableDir, "sdk");

            // Create directories
            Directory.CreateDirectory(_cwdSdkBaseDir);
            Directory.CreateDirectory(_userSdkBaseDir);
            Directory.CreateDirectory(_exeSdkBaseDir);

            // Trace messages used to identify from which folder the SDK was picked
            _exeSelectedMessage = $"Using dotnet SDK dll=[{_exeSdkBaseDir}";
        }
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                TestFrameworkDependentFixture = new TestProjectFixture("AppWithSubDirs", RepoDirectories);
                BundleHelper.AddLongNameContentToAppWithSubDirs(TestFrameworkDependentFixture);
                TestFrameworkDependentFixture
                .EnsureRestoredForRid(TestFrameworkDependentFixture.CurrentRid, RepoDirectories.CorehostPackages)
                .PublishProject(runtime: TestFrameworkDependentFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestFrameworkDependentFixture));

                TestSelfContainedFixture = new TestProjectFixture("AppWithSubDirs", RepoDirectories);
                BundleHelper.AddLongNameContentToAppWithSubDirs(TestSelfContainedFixture);
                TestSelfContainedFixture
                .EnsureRestoredForRid(TestSelfContainedFixture.CurrentRid, RepoDirectories.CorehostPackages)
                .PublishProject(runtime: TestSelfContainedFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestSelfContainedFixture));

                TestAppWithEmptyFileFixture = new TestProjectFixture("AppWithSubDirs", RepoDirectories);
                BundleHelper.AddLongNameContentToAppWithSubDirs(TestAppWithEmptyFileFixture);
                BundleHelper.AddEmptyContentToApp(TestAppWithEmptyFileFixture);
                TestAppWithEmptyFileFixture
                .EnsureRestoredForRid(TestAppWithEmptyFileFixture.CurrentRid, RepoDirectories.CorehostPackages)
                .PublishProject(runtime: TestAppWithEmptyFileFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestAppWithEmptyFileFixture));
            }
Exemplo n.º 10
0
        public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
        {
            var repoDirectoriesProvider = new RepoDirectoriesProvider();

            var testInstance = TestAssets.Get("TestAppWithProjDepTool")
                               .CreateInstance()
                               .WithSourceFiles()
                               .WithRestoreFiles();

            var configuration = "Debug";

            var testProjectDirectory = testInstance.Root;

            new BuildCommand()
            .WithWorkingDirectory(testProjectDirectory)
            .Execute($"-c {configuration} ")
            .Should()
            .Pass();

            new DotnetCommand()
            .WithWorkingDirectory(testProjectDirectory)
            .ExecuteWithCapturedOutput(
                $"-d dependency-tool-invoker -c {configuration} -f netcoreapp3.0 portable")
            .Should().Pass()
            .And.HaveStdOutContaining("Hello Portable World!");;
        }
Exemplo n.º 11
0
            public SharedTestState()
            {
                copiedDotnet = Path.Combine(TestArtifact.TestArtifactsPath, "runtimeProperties");
                SharedFramework.CopyDirectory(Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"), copiedDotnet);

                MockSDK = new DotNetBuilder(copiedDotnet, Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"), "exe")
                          .AddMicrosoftNETCoreAppFrameworkMockCoreClr("9999.0.0")
                          .AddMockSDK("9999.0.0-dev", "9999.0.0")
                          .Build();

                File.WriteAllText(Path.Combine(MockSDK.BinPath, "global.json"),
                                  @"
{
    ""sdk"": {
      ""version"": ""9999.0.0-dev""
    }
}");

                RepoDirectories = new RepoDirectoriesProvider(builtDotnet: copiedDotnet);

                RuntimePropertiesFixture = new TestProjectFixture("RuntimeProperties", RepoDirectories)
                                           .EnsureRestored()
                                           .BuildProject();

                RuntimeConfig.FromFile(RuntimePropertiesFixture.TestProject.RuntimeConfigJson)
                .WithProperty(AppTestPropertyName, AppTestPropertyValue)
                .Save();

                RuntimeConfig.FromFile(Path.Combine(RuntimePropertiesFixture.BuiltDotnet.GreatestVersionSharedFxPath, "Microsoft.NETCore.App.runtimeconfig.json"))
                .WithProperty(FrameworkTestPropertyName, FrameworkTestPropertyValue)
                .Save();
            }
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                TestFrameworkDependentFixture = new TestProjectFixture("AppWithSubDirs", RepoDirectories);
                TestFrameworkDependentFixture
                .EnsureRestoredForRid(TestFrameworkDependentFixture.CurrentRid, RepoDirectories.CorehostPackages)
                .PublishProject(runtime: TestFrameworkDependentFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestFrameworkDependentFixture));

                TestSelfContainedFixture = new TestProjectFixture("AppWithSubDirs", RepoDirectories);
                TestSelfContainedFixture
                .EnsureRestoredForRid(TestSelfContainedFixture.CurrentRid, RepoDirectories.CorehostPackages)
                .PublishProject(runtime: TestSelfContainedFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestSelfContainedFixture));

                TestAppWithEmptyFileFixture = new TestProjectFixture("AppWithSubDirs", RepoDirectories);
                XDocument projectDoc = XDocument.Load(TestAppWithEmptyFileFixture.TestProject.ProjectFile);

                projectDoc.Root.Add(
                    new XElement("ItemGroup",
                                 new XElement("Content",
                                              new XAttribute("Include", "empty.txt"),
                                              new XElement("CopyToOutputDirectory", "PreserveNewest"))));
                projectDoc.Save(TestAppWithEmptyFileFixture.TestProject.ProjectFile);
                File.WriteAllBytes(Path.Combine(TestAppWithEmptyFileFixture.TestProject.Location, "empty.txt"), new byte[0]);
                TestAppWithEmptyFileFixture
                .EnsureRestoredForRid(TestAppWithEmptyFileFixture.CurrentRid, RepoDirectories.CorehostPackages)
                .PublishProject(runtime: TestAppWithEmptyFileFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestAppWithEmptyFileFixture));
            }
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                PreviouslyPublishedAndRestoredPortableApiTestProjectFixture = new TestProjectFixture("HostApiInvokerApp", RepoDirectories)
                                                                              .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                              .BuildProject();

                PreviouslyPublishedAndRestoredPortableAppProjectFixture = new TestProjectFixture("PortableApp", RepoDirectories)
                                                                          .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                          .PublishProject();

                PreviouslyPublishedAndRestoredPortableAppWithExceptionProjectFixture = new TestProjectFixture("PortableAppWithException", RepoDirectories)
                                                                                       .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                                       .PublishProject();

                if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    BreadcrumbLocation = Path.Combine(
                        PreviouslyPublishedAndRestoredPortableAppWithExceptionProjectFixture.TestProject.OutputDirectory,
                        "opt",
                        "corebreadcrumbs");
                    Directory.CreateDirectory(BreadcrumbLocation);
                }
            }
Exemplo n.º 14
0
            public SharedTestState()
            {
                // The dotnetSDKLookup dir will contain some folders and files that will be
                // necessary to perform the tests
                string baseDir = Path.Combine(TestArtifact.TestArtifactsPath, "dotnetSDKLookup");

                BaseDir = SharedFramework.CalculateUniqueTestDirectory(baseDir);

                // The three tested locations will be the cwd and the exe dir. cwd is no longer supported.
                //     All dirs will be placed inside the base folder

                BuiltDotNet = new DotNetCli(Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"));

                RepoDirectories = new RepoDirectoriesProvider();

                // Executable location is created per test as each test adds a different set of SDK versions

                var currentWorkingSdk = new DotNetBuilder(BaseDir, BuiltDotNet.BinPath, "current")
                                        .AddMockSDK("10000.0.0", "9999.0.0")
                                        .Build();

                CurrentWorkingDir = currentWorkingSdk.BinPath;

                TestAssetsPath = Path.Combine(RepoDirectories.TestAssetsFolder, "TestUtils", "SDKLookup");
            }
 public GivenAProjectDependenciesCommandFactory()
 {
     _repoDirectoriesProvider = new RepoDirectoriesProvider();
     Environment.SetEnvironmentVariable(
         Constants.MSBUILD_EXE_PATH,
         Path.Combine(_repoDirectoriesProvider.Stage2Sdk, "MSBuild.dll"));
 }
        public void ActivateDotnetTestXunitOnTestProject(
            RepoDirectoriesProvider repoDirectories,
            TestProjectFixture testProjectFixture)
        {
            var dotnet = testProjectFixture.BuiltDotnet;

            var dotnetTestXunitDll    = FindDotnetTestXunitDll(repoDirectories, DotnetTestXunitVersion);
            var depsJson              = testProjectFixture.TestProject.DepsJson;
            var runtimeConfig         = testProjectFixture.TestProject.RuntimeConfigJson;
            var additionalProbingPath = RepoDirectories.NugetPackages;
            var appDll = testProjectFixture.TestProject.AppDll;

            dotnet.Exec(
                "exec",
                "--runtimeconfig", runtimeConfig,
                "--depsfile", depsJson,
                "--additionalProbingPath", additionalProbingPath,
                dotnetTestXunitDll,
                appDll)
            .CaptureStdErr()
            .CaptureStdOut()
            .Execute(fExpectedToFail: true)
            .Should()
            .Fail()
            .And
            .HaveStdOutContaining("Total: 2")
            .And
            .HaveStdOutContaining("Failed: 1");
        }
Exemplo n.º 17
0
 public SharedTestState()
 {
     RepoDirectories = new RepoDirectoriesProvider();
     TestFixture     = new TestProjectFixture("SingleFileApiTests", RepoDirectories);
     TestFixture
     .EnsureRestoredForRid(TestFixture.CurrentRid, RepoDirectories.CorehostPackages)
     .PublishProject(runtime: TestFixture.CurrentRid, outputDirectory: BundleHelper.GetPublishPath(TestFixture));
 }
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                PortableTestWindowsOsShimsAppFixture = new TestProjectFixture("TestWindowsOsShimsApp", RepoDirectories)
                                                       .EnsureRestored(RepoDirectories.CorehostPackages)
                                                       .PublishProject();
            }
Exemplo n.º 19
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                PortableAppFixture = new TestProjectFixture("PortableApp", RepoDirectories)
                                     .EnsureRestored(RepoDirectories.CorehostPackages)
                                     .BuildProject();
            }
        public GivenThatICareAboutDotnetArgValidationScenarios()
        {
            RepoDirectories = new RepoDirectoriesProvider();

            PreviouslyBuiltAndRestoredPortableTestProjectFixture = new TestProjectFixture("PortableApp", RepoDirectories)
                                                                   .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                   .BuildProject();
        }
Exemplo n.º 21
0
        public GivenThatICareAboutMultilevelSharedFxLookup()
        {
            // From the artifacts dir, it's possible to find where the sharedFrameworkPublish folder is. We need
            // to locate it because we'll copy its contents into other folders
            string artifactsDir = Environment.GetEnvironmentVariable("TEST_ARTIFACTS");
            string builtDotnet  = Path.Combine(artifactsDir, "..", "..", "intermediate", "sharedFrameworkPublish");

            // The dotnetMultilevelSharedFxLookup dir will contain some folders and files that will be
            // necessary to perform the tests
            string baseMultilevelDir = Path.Combine(artifactsDir, "dotnetMultilevelSharedFxLookup");
            string multilevelDir     = CalculateMultilevelDirectory(baseMultilevelDir);

            // The three tested locations will be the cwd, the user folder and the exe dir. Both cwd and exe dir
            // are easily overwritten, so they will be placed inside the multilevel folder. The actual user location will
            // be used during tests
            _currentWorkingDir = Path.Combine(multilevelDir, "cwd");
            if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
            {
                _userDir = Environment.GetEnvironmentVariable("USERPROFILE");
            }
            else
            {
                _userDir = Environment.GetEnvironmentVariable("HOME");
            }
            _executableDir = Path.Combine(multilevelDir, "exe");

            // SharedFxBaseDirs contain all available version folders
            _cwdSharedFxBaseDir  = Path.Combine(_currentWorkingDir, "shared", "Microsoft.NETCore.App");
            _userSharedFxBaseDir = Path.Combine(_userDir, ".dotnet", RuntimeEnvironment.RuntimeArchitecture, "shared", "Microsoft.NETCore.App");
            _exeSharedFxBaseDir  = Path.Combine(_executableDir, "shared", "Microsoft.NETCore.App");

            // Create directories. It's necessary to copy the entire publish folder to the exe dir because
            // we'll need to build from it. The CopyDirectory method automatically creates the dest dir
            Directory.CreateDirectory(_cwdSharedFxBaseDir);
            Directory.CreateDirectory(_userSharedFxBaseDir);
            CopyDirectory(builtDotnet, _executableDir);

            // Restore and build SharedFxLookupPortableApp from exe dir
            RepoDirectories = new RepoDirectoriesProvider(builtDotnet: _executableDir);
            PreviouslyBuiltAndRestoredPortableTestProjectFixture = new TestProjectFixture("SharedFxLookupPortableApp", RepoDirectories)
                                                                   .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                   .BuildProject();
            var fixture = PreviouslyBuiltAndRestoredPortableTestProjectFixture;

            // The actual framework version can be obtained from the built fixture. We'll use it to
            // locate the builtSharedFxDir from which we can get the files contained in the version folder
            string greatestVersionSharedFxPath = fixture.BuiltDotnet.GreatestVersionSharedFxPath;

            _sharedFxVersion  = (new DirectoryInfo(greatestVersionSharedFxPath)).Name;
            _builtSharedFxDir = Path.Combine(builtDotnet, "shared", "Microsoft.NETCore.App", _sharedFxVersion);

            string hostPolicyDllName = Path.GetFileName(fixture.TestProject.HostPolicyDll);

            // Trace messages used to identify from which folder the framework was picked
            _cwdSelectedMessage  = $"The expected {hostPolicyDllName} directory is [{_cwdSharedFxBaseDir}";
            _userSelectedMessage = $"The expected {hostPolicyDllName} directory is [{_userSharedFxBaseDir}";
            _exeSelectedMessage  = $"The expected {hostPolicyDllName} directory is [{_exeSharedFxBaseDir}";
        }
            public SharedTestStateBase()
            {
                _builtDotnet     = Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish");
                _repoDirectories = new RepoDirectoriesProvider();

                string baseDir = Path.Combine(TestArtifact.TestArtifactsPath, "frameworkResolution");

                _baseDir = SharedFramework.CalculateUniqueTestDirectory(baseDir);
            }
Exemplo n.º 23
0
        private static TestProjectFixture CreatePublishedFixture(string netCoreAppFramework, string mnaVersion)
        {
            var repoDirectories = new RepoDirectoriesProvider(microsoftNETCoreAppVersion: mnaVersion);
            var fixture         = new TestProjectFixture("StandaloneApp3x", repoDirectories, framework: netCoreAppFramework, assemblyName: "StandaloneApp");

            fixture.PublishProject(runtime: fixture.CurrentRid, outputDirectory: BundleHelper.GetPublishPath(fixture), restore: true);

            return(fixture);
        }
Exemplo n.º 24
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                // Entry point projects
                PreviouslyPublishedAndRestoredPortableAppProjectFixture = new TestProjectFixture("PortableApp", RepoDirectories)
                                                                          .EnsureRestored(RepoDirectories.CorehostPackages)
                                                                          .PublishProject();
            }
Exemplo n.º 25
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                TestFixture = new TestProjectFixture("StandaloneAppWithSubDirs", RepoDirectories);
                TestFixture
                .EnsureRestoredForRid(TestFixture.CurrentRid, RepoDirectories.CorehostPackages)
                .PublishProject(runtime: TestFixture.CurrentRid);
            }
Exemplo n.º 26
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                // Entry point projects
                PortableAppFixture = new TestProjectFixture("PortableApp", RepoDirectories)
                                     .EnsureRestored()
                                     .PublishProject();
            }
Exemplo n.º 27
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();
                TestFixture     = PreparePublishedSelfContainedTestProject("HammerServiceApp");

                ServiceFixture = new TestProjectFixture("ServicedLocation", RepoDirectories, assemblyName: "Location");
                ServiceFixture
                .EnsureRestored(RepoDirectories.CorehostPackages)
                .PublishProject(outputDirectory: BundleHelper.GetPublishPath(ServiceFixture));
            }
Exemplo n.º 28
0
        public static NuGetArtifactTester Open(
            RepoDirectoriesProvider dirs,
            string project,
            string id = null)
        {
            var tester = OpenOrNull(dirs, project, id);

            Assert.NotNull(tester);
            return(tester);
        }
Exemplo n.º 29
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                TestFixture = new TestProjectFixture("StandaloneApp", RepoDirectories);
                TestFixture
                .EnsureRestoredForRid(TestFixture.CurrentRid)
                .PublishProject(runtime: TestFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestFixture));
            }
Exemplo n.º 30
0
            public SharedTestState()
            {
                RepoDirectories = new RepoDirectoriesProvider();

                TestFixture = new TestProjectFixture("AppWithSubDirs", RepoDirectories);
                BundleHelper.AddLongNameContentToAppWithSubDirs(TestFixture);
                TestFixture
                .EnsureRestoredForRid(TestFixture.CurrentRid)
                .PublishProject(runtime: TestFixture.CurrentRid,
                                outputDirectory: BundleHelper.GetPublishPath(TestFixture));
            }