dotnet-installer/test/EndToEnd/GivenSelfContainedAppsRollForward.cs

157 lines
6.6 KiB
C#
Raw Normal View History

using System;
using System.IO;
using System.Linq;
[master] Update dependencies from dotnet/sdk (#7208) * Update dependencies from https://github.com/dotnet/sdk build 20200417.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.2 * Update dependencies from https://github.com/dotnet/sdk build 20200417.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.3 * Update dependencies from https://github.com/dotnet/sdk build 20200417.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.4 * Update dependencies from https://github.com/dotnet/sdk build 20200417.5 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.5 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.5 * Update dependencies from https://github.com/dotnet/sdk build 20200417.6 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.6 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.6 * Update dependencies from https://github.com/dotnet/sdk build 20200417.7 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.7 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.7 * Update dependencies from https://github.com/dotnet/sdk build 20200417.8 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.8 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.8 * Update dependencies from https://github.com/dotnet/sdk build 20200418.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.1 * Update dependencies from https://github.com/dotnet/sdk build 20200418.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.2 * Update dependencies from https://github.com/dotnet/sdk build 20200418.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.3 * Update dependencies from https://github.com/dotnet/sdk build 20200418.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.4 * Update dependencies from https://github.com/dotnet/sdk build 20200419.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.1 * Update dependencies from https://github.com/dotnet/sdk build 20200419.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.2 * Update dependencies from https://github.com/dotnet/sdk build 20200419.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.3 * Update dependencies from https://github.com/dotnet/sdk build 20200420.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.1 * Update dependencies from https://github.com/dotnet/sdk build 20200420.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.2 * Update dependencies from https://github.com/dotnet/sdk build 20200420.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.3 * Switch to using RuntimeInformation APIs instead of deprecated PlatformAbstractions See https://github.com/dotnet/sdk/pull/11076 * Update dependencies from https://github.com/dotnet/sdk build 20200420.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.4 * Update dependencies from https://github.com/dotnet/sdk build 20200420.5 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.5 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.5 * Update dependencies from https://github.com/dotnet/sdk build 20200420.7 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.7 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.7 * Update dependencies from https://github.com/dotnet/sdk build 20200420.8 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.8 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.8 * Update dependencies from https://github.com/dotnet/sdk build 20200420.10 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.10 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.10 * Update dependencies from https://github.com/dotnet/sdk build 20200420.12 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.12 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.12 * Update dependencies from https://github.com/dotnet/sdk build 20200420.13 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.13 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.13 * Update dependencies from https://github.com/dotnet/sdk build 20200421.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.1 * Update dependencies from https://github.com/dotnet/sdk build 20200421.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.2 * Update dependencies from https://github.com/dotnet/sdk build 20200421.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.3 * Update dependencies from https://github.com/dotnet/sdk build 20200421.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.4 * Update dependencies from https://github.com/dotnet/sdk build 20200421.5 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.5.20221.5 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.5.20221.5 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Daniel Plaisted <daplaist@microsoft.com>
2020-04-21 20:54:31 +00:00
using System.Runtime.InteropServices;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using NuGet.ProjectModel;
using NuGet.Versioning;
using Xunit;
namespace EndToEnd
{
public partial class GivenSelfContainedAppsRollForward : TestBase
{
internal void ItRollsForwardToTheLatestVersion(string packageName, string minorVersion)
{
2018-11-08 20:11:30 +00:00
var testProjectCreator = new TestProjectCreator()
{
2018-11-08 20:11:30 +00:00
PackageName = packageName,
MinorVersion = minorVersion,
// Set RuntimeIdentifier to opt in to roll-forward behavior
[master] Update dependencies from dotnet/sdk (#7208) * Update dependencies from https://github.com/dotnet/sdk build 20200417.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.2 * Update dependencies from https://github.com/dotnet/sdk build 20200417.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.3 * Update dependencies from https://github.com/dotnet/sdk build 20200417.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.4 * Update dependencies from https://github.com/dotnet/sdk build 20200417.5 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.5 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.5 * Update dependencies from https://github.com/dotnet/sdk build 20200417.6 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.6 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.6 * Update dependencies from https://github.com/dotnet/sdk build 20200417.7 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.7 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.7 * Update dependencies from https://github.com/dotnet/sdk build 20200417.8 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.8 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20217.8 * Update dependencies from https://github.com/dotnet/sdk build 20200418.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.1 * Update dependencies from https://github.com/dotnet/sdk build 20200418.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.2 * Update dependencies from https://github.com/dotnet/sdk build 20200418.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.3 * Update dependencies from https://github.com/dotnet/sdk build 20200418.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20218.4 * Update dependencies from https://github.com/dotnet/sdk build 20200419.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.1 * Update dependencies from https://github.com/dotnet/sdk build 20200419.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.2 * Update dependencies from https://github.com/dotnet/sdk build 20200419.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20219.3 * Update dependencies from https://github.com/dotnet/sdk build 20200420.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.1 * Update dependencies from https://github.com/dotnet/sdk build 20200420.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.2 * Update dependencies from https://github.com/dotnet/sdk build 20200420.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.3 * Switch to using RuntimeInformation APIs instead of deprecated PlatformAbstractions See https://github.com/dotnet/sdk/pull/11076 * Update dependencies from https://github.com/dotnet/sdk build 20200420.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.4 * Update dependencies from https://github.com/dotnet/sdk build 20200420.5 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.5 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.5 * Update dependencies from https://github.com/dotnet/sdk build 20200420.7 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.7 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.7 * Update dependencies from https://github.com/dotnet/sdk build 20200420.8 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.8 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.8 * Update dependencies from https://github.com/dotnet/sdk build 20200420.10 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.10 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.10 * Update dependencies from https://github.com/dotnet/sdk build 20200420.12 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.12 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.12 * Update dependencies from https://github.com/dotnet/sdk build 20200420.13 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.13 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20220.13 * Update dependencies from https://github.com/dotnet/sdk build 20200421.1 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.1 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.1 * Update dependencies from https://github.com/dotnet/sdk build 20200421.2 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.2 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.2 * Update dependencies from https://github.com/dotnet/sdk build 20200421.3 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.3 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.3 * Update dependencies from https://github.com/dotnet/sdk build 20200421.4 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.4 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.4.20221.4 * Update dependencies from https://github.com/dotnet/sdk build 20200421.5 - Microsoft.DotNet.MSBuildSdkResolver: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.5.20221.5 - Microsoft.NET.Sdk: 5.0.100-preview.4.20217.1 -> 5.0.100-preview.5.20221.5 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Daniel Plaisted <daplaist@microsoft.com>
2020-04-21 20:54:31 +00:00
RuntimeIdentifier = RuntimeInformation.RuntimeIdentifier
2018-11-08 20:11:30 +00:00
};
2018-11-08 20:11:30 +00:00
var testInstance = testProjectCreator.Create();
string projectDirectory = testInstance.Root.FullName;
// Get the version rolled forward to
new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should().Pass();
string assetsFilePath = Path.Combine(projectDirectory, "obj", "project.assets.json");
var assetsFile = new LockFileFormat().Read(assetsFilePath);
var rolledForwardVersion = GetPackageVersion(assetsFile, packageName);
rolledForwardVersion.Should().NotBeNull();
if (rolledForwardVersion.IsPrerelease)
{
// If this version of .NET Core is still prerelease, then:
// - Floating the patch by adding ".*" to the major.minor version won't work, but
// - There aren't any patches to roll-forward to, so we skip testing this until the version
// leaves prerelease.
return;
}
2018-11-08 20:11:30 +00:00
testProjectCreator.Identifier = "floating";
var floatingProjectInstance = testProjectCreator.Create();
var floatingProjectPath = Path.Combine(floatingProjectInstance.Root.FullName, "TestAppSimple.csproj");
var floatingProject = XDocument.Load(floatingProjectPath);
var ns = floatingProject.Root.Name.Namespace;
if (packageName == TestProjectCreator.NETCorePackageName)
{
// Float the RuntimeFrameworkVersion to get the latest version of the runtime available from feeds
2018-11-08 20:11:30 +00:00
floatingProject.Root.Element(ns + "PropertyGroup")
.Add(new XElement(ns + "RuntimeFrameworkVersion", $"{minorVersion}.*"));
}
else
{
2018-11-08 20:11:30 +00:00
floatingProject.Root.Element(ns + "ItemGroup")
.Element(ns + "PackageReference")
.Add(new XAttribute("Version", $"{minorVersion}.*"),
new XAttribute("AllowExplicitVersion", "true"));
}
2018-11-08 20:11:30 +00:00
floatingProject.Save(floatingProjectPath);
new RestoreCommand()
2018-11-08 20:11:30 +00:00
.WithWorkingDirectory(floatingProjectInstance.Root.FullName)
.Execute()
.Should().Pass();
2018-11-08 20:11:30 +00:00
string floatingAssetsFilePath = Path.Combine(floatingProjectInstance.Root.FullName, "obj", "project.assets.json");
var floatedAssetsFile = new LockFileFormat().Read(floatingAssetsFilePath);
var floatedVersion = GetPackageVersion(floatedAssetsFile, packageName);
floatedVersion.Should().NotBeNull();
rolledForwardVersion.ToNormalizedString().Should().BeEquivalentTo(floatedVersion.ToNormalizedString(),
$"the latest patch version for {packageName} {minorVersion} in Microsoft.NETCoreSdk.BundledVersions.props " +
"needs to be updated (see the ImplicitPackageVariable items in MSBuildExtensions.targets in this repo)");
}
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName)
{
return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null)
?.Libraries?.SingleOrDefault(l =>
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
?.Version;
}
2018-11-12 23:24:05 +00:00
[Fact]
public void WeCoverLatestNetCoreAppRollForward()
{
// Run "dotnet new console", get TargetFramework property, and make sure it's covered in SupportedNetCoreAppVersions
2018-10-29 18:26:53 +00:00
var directory = TestAssets.CreateTestDirectory();
string projectDirectory = directory.FullName;
2018-10-29 18:26:53 +00:00
new NewCommandShim()
.WithWorkingDirectory(projectDirectory)
.Execute("console --no-restore")
.Should().Pass();
2018-10-29 18:26:53 +00:00
string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
2018-10-29 18:26:53 +00:00
var project = XDocument.Load(projectPath);
var ns = project.Root.Name.Namespace;
2018-10-29 18:26:53 +00:00
string targetFramework = project.Root.Element(ns + "PropertyGroup")
.Element(ns + "TargetFramework")
.Value;
SupportedNetCoreAppVersions.TargetFrameworkShortFolderVersion
2018-10-29 18:26:53 +00:00
.Should().Contain(targetFramework, $"the {nameof(SupportedNetCoreAppVersions)}.{nameof(SupportedNetCoreAppVersions.Versions)} property should include the default version " +
"of .NET Core created by \"dotnet new\"");
}
[Fact]
public void WeCoverLatestAspNetCoreAppRollForward()
{
2018-10-29 18:26:53 +00:00
var directory = TestAssets.CreateTestDirectory();
string projectDirectory = directory.FullName;
// Run "dotnet new web", get TargetFramework property, and make sure it's covered in SupportedAspNetCoreAppVersions
2018-10-29 18:26:53 +00:00
new NewCommandShim()
.WithWorkingDirectory(projectDirectory)
.Execute("web --no-restore")
.Should().Pass();
2018-10-29 18:26:53 +00:00
string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
2018-10-29 18:26:53 +00:00
var project = XDocument.Load(projectPath);
var ns = project.Root.Name.Namespace;
2018-10-29 18:26:53 +00:00
string targetFramework = project.Root.Element(ns + "PropertyGroup")
.Element(ns + "TargetFramework")
.Value;
TargetFrameworkHelper.GetNetAppTargetFrameworks(SupportedAspNetCoreVersions.Versions)
2018-10-29 18:26:53 +00:00
.Should().Contain(targetFramework, $"the {nameof(SupportedAspNetCoreVersions)} should include the default version " +
"of Microsoft.AspNetCore.App used by the templates created by \"dotnet new web\"");
}
}
}