public void Precedence() { string [] versions = { "0.0.0-beta.1", "0.0.0-beta.1+build.1", "0.0.0-beta.1+build.2", "0.0.0-beta.2", "0.0.0-beta.2+build.1", "0.0.0-beta.2+build.2", "0.0.0", "0.1.0", "0.1.1-dev", "0.1.1-alpha", "0.1.1-beta", "0.1.1-rc", "0.1.1-rc.1", "0.1.1-rc.2", "0.1.1-rc.3", "0.1.1-rc.3+build.1", "0.1.1", "1.0.1", "1.2.0-rc.2", "1.2.0-rc.3", "1.2.0-rc4", "1.2.0", "1.2.1-rc.9", "1.2.1", "1.4.0-alpha1", "1.4.0-alpha2", "1.4.0-alpha3", "1.4.0-beta1", "1.4.0-beta2", "1.4.0-beta.3", "1.4.0-preview1", "1.4.0-preview.2", "1.4.0-rc", "1.4.0-rc1", "1.4.0-rc2", "1.4.0" }; for (int i = 1; i < versions.Length; i++) { var older = ReleaseVersion.Parse(versions [i - 1]); var newer = ReleaseVersion.Parse(versions [i]); newer.ShouldBeGreaterThan(older); older.ShouldBeLessThan(newer); // Windows file version test does an equal to as well since // the conversion drops the build component, which makes // some of the versions we check equal. var olderSV = older.ToWindowsFileVersion(); var newerSV = newer.ToWindowsFileVersion(); newerSV.ShouldBeGreaterThanOrEqualTo(olderSV); olderSV.ShouldBeLessThanOrEqualTo(newerSV); } }
public void CheckForNoMajorReleasesTest() { Version currentVersion = new(2, 48); var availableVersions = ReleaseVersion.Parse(GetReleasesConfigFileText()); var updates = ReleaseVersion.GetNewerVersions(currentVersion, false, availableVersions); updates.Select(rv => rv.Version).Should().BeEmpty(); }
public void CheckForMajorReleasesTest() { Version currentVersion = new(2, 47); var availableVersions = ReleaseVersion.Parse(GetReleasesConfigFileText()); var updates = ReleaseVersion.GetNewerVersions(currentVersion, false, availableVersions); var expectedVersions = new[] { new Version(2, 48) }; updates.Select(rv => rv.Version).Should().Equal(expectedVersions); }
public void Equality() { ReleaseVersion [] versions = { ReleaseVersion.Parse("0.0.0"), new ReleaseVersion(0, 0, 0), ReleaseVersion.Parse("99.99.99"), new ReleaseVersion(99, 99, 99), ReleaseVersion.Parse("99.99.99-rc.99+build.9999"), new ReleaseVersion(99, 99, 99,ReleaseCandidateLevel.StableCandidate,99, 9999), ReleaseVersion.Parse("0.99.0-beta.3+build.6692"), new ReleaseVersion(0, 99, 0,ReleaseCandidateLevel.Beta, 3, 6692) }; for (int i = 0; i < versions.Length; i += 2) { versions [i].ShouldEqual(versions [i + 1]); } }
public void NuGetSafe(string semVer, string expectedNuGetSafe) => ReleaseVersion .Parse(semVer) .ToString(ReleaseVersionFormat.SemVer, true, true) .ShouldEqual(expectedNuGetSafe);
public void Friendly(string semVer, string expectedFriendly, bool withBuildComponent) => ReleaseVersion .Parse(semVer) .ToString(ReleaseVersionFormat.FriendlyShort, withBuildComponent) .ShouldEqual(expectedFriendly);
public void VerboseParse(string longerSemVerForm, string shorterSemVerForm) => ReleaseVersion .Parse(longerSemVerForm) .ToString() .ShouldEqual(shorterSemVerForm);
public void CFBundleVersion(string semVer, string expectedCFBundleVersion) => ReleaseVersion .Parse(semVer) .ToString(ReleaseVersionFormat.AppleCFBundleVersion) .ShouldEqual(expectedCFBundleVersion);