public void LooksOnlyOnEnvironmentVariableOnNonWindows()
        {
            var runtime = new Mock <IRuntimeEnvironment>();

            runtime.SetupGet(r => r.OperatingSystemPlatform).Returns(Platform.Linux);

            var result = ReferenceAssemblyPathResolver.GetDefaultReferenceAssembliesPath(runtime.Object, FileSystemMockBuilder.Empty, EnvironmentMockBuilder.Empty);

            result.Should().BeNull();
        }
        public void ReturnsProgramFilesAsDefaultLocationOnWin32()
        {
            var environment = EnvironmentMockBuilder.Create()
                              .AddVariable("ProgramFiles", "Program Files")
                              .Build();

            var result = ReferenceAssemblyPathResolver.GetDefaultReferenceAssembliesPath(FileSystemMockBuilder.Empty, Platform.Windows, environment);

            result.Should().Be(Path.Combine("Program Files", "Reference Assemblies", "Microsoft", "Framework"));
        }
        public void UsesEnvironmentVariableForDefaultPath()
        {
            var environment = EnvironmentMockBuilder.Create()
                              .AddVariable("DOTNET_REFERENCE_ASSEMBLIES_PATH", ReferencePath)
                              .Build();

            var result = ReferenceAssemblyPathResolver.GetDefaultReferenceAssembliesPath(FileSystemMockBuilder.Empty, Platform.Windows, environment);

            result.Should().Be(ReferencePath);
        }
        public void ReturnsProgramFilesAsDefaultLocationOnWin32()
        {
            var runtime = new Mock <IRuntimeEnvironment>();

            runtime.SetupGet(r => r.OperatingSystemPlatform).Returns(Platform.Windows);

            var environment = EnvironmentMockBuilder.Create()
                              .AddVariable("ProgramFiles", "Program Files")
                              .Build();

            var result = ReferenceAssemblyPathResolver.GetDefaultReferenceAssembliesPath(runtime.Object, FileSystemMockBuilder.Empty, environment);

            result.Should().Be(Path.Combine("Program Files", "Reference Assemblies", "Microsoft", "Framework"));
        }
        public void UsesEnvironmentVariableForDefaultPath()
        {
            var runtime = new Mock <IRuntimeEnvironment>();

            runtime.SetupGet(r => r.OperatingSystemPlatform).Returns(Platform.Windows);

            var environment = EnvironmentMockBuilder.Create()
                              .AddVariable("DOTNET_REFERENCE_ASSEMBLIES_PATH", ReferencePath)
                              .Build();

            var result = ReferenceAssemblyPathResolver.GetDefaultReferenceAssembliesPath(runtime.Object, FileSystemMockBuilder.Empty, environment);

            result.Should().Be(ReferencePath);
        }
Esempio n. 6
0
        public void LooksOnlyOnEnvironmentVariableOnNonWindows()
        {
            var result = ReferenceAssemblyPathResolver.GetDefaultReferenceAssembliesPath(FileSystemMockBuilder.Empty, EnvironmentMockBuilder.Empty);

            result.Should().BeNull();
        }