コード例 #1
0
        public void Given3RuntimeFrameworksItCanGenerateWithoutAssetFile()
        {
            var task = new TestableGenerateRuntimeConfigurationFiles
            {
                BuildEngine            = new MockNeverCacheBuildEngine4(),
                TargetFrameworkMoniker = ".NETCoreApp,Version=v3.0",
                TargetFramework        = "netcoreapp3.0",
                RuntimeConfigPath      = _runtimeConfigPath,
                RuntimeConfigDevPath   = _runtimeConfigDevPath,
                RuntimeFrameworks      = new[]
                {
                    new MockTaskItem(
                        "Microsoft.NETCore.App",
                        new Dictionary <string, string>
                    {
                        { "FrameworkName", "Microsoft.NETCore.App" }, { "Version", "3.1.0" }
                    }
                        ),
                    new MockTaskItem(
                        "Microsoft.WindowsDesktop.App",
                        new Dictionary <string, string>
                    {
                        { "FrameworkName", "Microsoft.WindowsDesktop.App" }, { "Version", "3.1.0" }
                    }
                        ),
                    new MockTaskItem(
                        "Microsoft.AspNetCore.App",
                        new Dictionary <string, string>
                    {
                        { "FrameworkName", "Microsoft.AspNetCore.App" }, { "Version", "3.1.0" }
                    }
                        )
                },
                RollForward = "LatestMinor"
            };

            Action a = () => task.PublicExecuteCore();

            a.ShouldNotThrow();

            File.ReadAllText(_runtimeConfigPath).Should()
            .Be(
                @"{
  ""runtimeOptions"": {
    ""tfm"": ""netcoreapp3.0"",
    ""rollForward"": ""LatestMinor"",
    ""frameworks"": [
      {
        ""name"": ""Microsoft.WindowsDesktop.App"",
        ""version"": ""3.1.0""
      },
      {
        ""name"": ""Microsoft.AspNetCore.App"",
        ""version"": ""3.1.0""
      }
    ]
  }
}",
                "There is no Microsoft.NETCore.App. And it is under frameworkS.");
        }
コード例 #2
0
        public void ItCanGenerateWithoutAssetFile()
        {
            var task = new TestableGenerateRuntimeConfigurationFiles
            {
                BuildEngine            = new MockNeverCacheBuildEngine4(),
                TargetFrameworkMoniker = ".NETCoreApp,Version=v3.0",
                TargetFramework        = "netcoreapp3.0",
                RuntimeConfigPath      = _runtimeConfigPath,
                RuntimeConfigDevPath   = _runtimeConfigDevPath,
                RuntimeFrameworks      = new[]
                {
                    new MockTaskItem(
                        "Microsoft.NETCore.App",
                        new Dictionary <string, string>
                    {
                        { "FrameworkName", "Microsoft.NETCore.App" }, { "Version", "3.0.0-preview1.100" }
                    }
                        )
                },
                RollForward = "LatestMinor"
            };

            Action a = () => task.PublicExecuteCore();

            a.ShouldNotThrow();

            File.ReadAllText(_runtimeConfigPath).Should()
            .Be(
                @"{
  ""runtimeOptions"": {
    ""tfm"": ""netcoreapp3.0"",
    ""rollForward"": ""LatestMinor"",
    ""framework"": {
      ""name"": ""Microsoft.NETCore.App"",
      ""version"": ""3.0.0-preview1.100""
    }
  }
}");
            File.Exists(_runtimeConfigDevPath).Should().BeFalse("No nuget involved, so no extra probing path");
        }
コード例 #3
0
        public void GivenTargetMonikerItGeneratesShortName()
        {
            var task = new TestableGenerateRuntimeConfigurationFiles
            {
                BuildEngine            = new MockNeverCacheBuildEngine4(),
                TargetFrameworkMoniker = ".NETCoreApp,Version=v5.0",
                RuntimeConfigPath      = _runtimeConfigPath,
                RuntimeConfigDevPath   = _runtimeConfigDevPath,
                RuntimeFrameworks      = new[]
                {
                    new MockTaskItem(
                        "Microsoft.NETCore.App",
                        new Dictionary <string, string>
                    {
                        { "FrameworkName", "Microsoft.NETCore.App" }, { "Version", "5.0.0" }
                    }
                        )
                },
                RollForward = "LatestMinor"
            };

            Action a = () => task.PublicExecuteCore();

            a.ShouldNotThrow();

            File.ReadAllText(_runtimeConfigPath).Should()
            .Be(
                @"{
  ""runtimeOptions"": {
    ""tfm"": ""net5.0"",
    ""rollForward"": ""LatestMinor"",
    ""framework"": {
      ""name"": ""Microsoft.NETCore.App"",
      ""version"": ""5.0.0""
    }
  }
}");
        }