Exemplo n.º 1
0
        public void ComparePrecedenceToReturnsRelativeSortOrder(string version1, string version2, int expectedPrecedence)
        {
            ReleaseVersion v1 = string.IsNullOrEmpty(version1) ? null : new ReleaseVersion(version1);
            ReleaseVersion v2 = string.IsNullOrEmpty(version2) ? null : new ReleaseVersion(version2);

            if (expectedPrecedence == 1)
            {
                Assert.True(v2.ComparePrecedenceTo(v1) > 0);
            }
            else if (expectedPrecedence == 0)
            {
                Assert.True(v2.ComparePrecedenceTo(v1) == 0);
            }
            else if (expectedPrecedence == -1)
            {
                Assert.True(v2.ComparePrecedenceTo(v1) < 0);
            }
        }
Exemplo n.º 2
0
        public void NumericIdentifiersCanBeLargerThanInt()
        {
            // Test for values that would break max int
            ReleaseVersion v1 = new ReleaseVersion("1.0.0-2147483647");
            ReleaseVersion v2 = new ReleaseVersion("1.0.0-2147483648");

            Assert.True(v1.ComparePrecedenceTo(v2) < 0);
            Assert.True(v2.ComparePrecedenceTo(v1) > 0);
        }