dotnet-installer/test/core-sdk-tasks.Tests/CalculateTemplateVerionsTests.cs

50 lines
1.7 KiB
C#
Raw Normal View History

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