2020-01-25 19:17:32 +00:00
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using Xunit;
|
|
|
|
|
using Microsoft.DotNet.Cli.Build;
|
|
|
|
|
|
|
|
|
|
namespace EndToEnd
|
|
|
|
|
{
|
2020-01-26 01:32:35 +00:00
|
|
|
|
public class CalculateTemplateVersionsTests
|
2020-01-25 19:17:32 +00:00
|
|
|
|
{
|
|
|
|
|
[Fact]
|
2020-01-28 18:49:14 +00:00
|
|
|
|
public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVersionsInStableBuilds()
|
2020-01-25 19:17:32 +00:00
|
|
|
|
{
|
2020-09-22 21:32:10 +00:00
|
|
|
|
var result = CalculateTemplateVersions.Calculate("3.1.0");
|
2020-01-28 18:49:14 +00:00
|
|
|
|
|
2024-02-07 19:27:29 +00:00
|
|
|
|
// The patch is 1 higher than aspnetTemplateVersion due to https://github.com/dotnet/core-sdk/issues/6243
|
|
|
|
|
result.InstallPath.Should().Be("3.1.1");
|
|
|
|
|
result.MajorMinorVersion.Should().Be("3.1");
|
|
|
|
|
result.MajorMinorPatchVersion.Should().Be("3.1.1");
|
2020-01-28 18:49:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVersionsInNonStableBuilds()
|
|
|
|
|
{
|
2020-09-22 21:32:10 +00:00
|
|
|
|
var result = CalculateTemplateVersions.Calculate("3.0.0-alpha.1.20071.6");
|
2020-01-28 18:49:14 +00:00
|
|
|
|
|
2024-02-07 19:27:29 +00:00
|
|
|
|
result.InstallPath.Should().Be("3.0.1-alpha.1.20071.6");
|
|
|
|
|
result.MajorMinorVersion.Should().Be("3.0");
|
|
|
|
|
result.MajorMinorPatchVersion.Should().Be("3.0.1");
|
2020-01-25 19:17:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
2020-01-28 18:49:14 +00:00
|
|
|
|
public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateVersionsInStableBuilds()
|
|
|
|
|
{
|
2020-09-22 21:32:10 +00:00
|
|
|
|
var result = CalculateTemplateVersions.Calculate("5.1.0");
|
2020-01-28 18:49:14 +00:00
|
|
|
|
|
2024-02-07 19:27:29 +00:00
|
|
|
|
// The patch align with AspNetCoreTemplateMajorVersion again, since there is no non-deterministic existing ComponentId under Major version 5.
|
|
|
|
|
result.InstallPath.Should().Be("5.1.0");
|
|
|
|
|
result.MajorMinorVersion.Should().Be("5.1");
|
|
|
|
|
result.MajorMinorPatchVersion.Should().Be("5.1.0");
|
2020-01-28 18:49:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateVersionsInNonStableBuilds()
|
2020-01-25 19:17:32 +00:00
|
|
|
|
{
|
2020-09-22 21:32:10 +00:00
|
|
|
|
var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6");
|
2020-01-28 18:49:14 +00:00
|
|
|
|
|
2024-02-07 19:27:29 +00:00
|
|
|
|
result.InstallPath.Should().Be("5.0.0-alpha.1.20071.6");
|
|
|
|
|
result.MajorMinorVersion.Should().Be("5.0");
|
|
|
|
|
result.MajorMinorPatchVersion.Should().Be("5.0.0");
|
2020-01-25 19:17:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|