当前位置: 首页>>代码示例>>C#>>正文


C# SemanticVersion.CompareTo方法代码示例

本文整理汇总了C#中SemanticVersion.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# SemanticVersion.CompareTo方法的具体用法?C# SemanticVersion.CompareTo怎么用?C# SemanticVersion.CompareTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SemanticVersion的用法示例。


在下文中一共展示了SemanticVersion.CompareTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompareToPatch

        public void CompareToPatch()
        {
            SemanticVersion left = new SemanticVersion(1, 1, 0);
            SemanticVersion right = new SemanticVersion(1, 1, 1);

            Assert.Equal(-1, left.CompareTo(right));
        }
开发者ID:Ruhrpottpatriot,项目名称:SemanticVersion,代码行数:7,代码来源:CompareToTests.cs

示例2: PreReleaseBiggerPreRelease

        public void PreReleaseBiggerPreRelease()
        {
            SemanticVersion v = new SemanticVersion(0, 2, 1, new PreRelease(PreReleaseStage.BETA));
            SemanticVersion o = new SemanticVersion(0, 2, 1, new PreRelease(PreReleaseStage.ALPHA));

            Assert.True(v.CompareTo(o) == 1);
        }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:7,代码来源:CompareTest.cs

示例3: CompareToBuildRightEmpty

        public void CompareToBuildRightEmpty()
        {
            SemanticVersion left = new SemanticVersion(1, 1, 0, build:"abc");
            SemanticVersion right = new SemanticVersion(1, 1, 0);

            Assert.Equal(1, left.CompareTo(right));
        }
开发者ID:Ruhrpottpatriot,项目名称:SemanticVersion,代码行数:7,代码来源:CompareToTests.cs

示例4: GeneralBiggerThanGeneral

        public void GeneralBiggerThanGeneral()
        {
            SemanticVersion v = new SemanticVersion(0, 2, 1);
            SemanticVersion o = new SemanticVersion(0, 2, 0);

            Assert.True(v.CompareTo(o) == 1);
        }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:7,代码来源:CompareTest.cs

示例5: GeneralEqualGeneral

        public void GeneralEqualGeneral()
        {
            SemanticVersion v = new SemanticVersion(0, 2, 1);
            SemanticVersion o = new SemanticVersion(0, 2, 1);

            Assert.True(v.CompareTo(o) == 0);
        }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:7,代码来源:CompareTest.cs

示例6: SameSemanticVersionIsEqual

        public void SameSemanticVersionIsEqual(SemanticVersion semVer)
        {
            const int expected = 0;

            var actual = semVer.CompareTo(semVer);

            Assert.Equal(expected, actual);
        }
开发者ID:cyberzed,项目名称:SemanticVersioning,代码行数:8,代码来源:SemanticVersionComparerTests.cs

示例7: CompareToWithWrongType

        public void CompareToWithWrongType()
        {
            // Setup
            var version = new SemanticVersion("1.0.0");

            // Execute
            var result = version.CompareTo("This is not a SemanticVersion!");
        }
开发者ID:jsmunroe,项目名称:Helpers,代码行数:8,代码来源:SemanticVersionTest.cs

示例8: ComparableParseTest

        public void ComparableParseTest()
        {
            SemanticVersion v;
            Assert.True(SemanticVersion.TryParse("0.1111.5-rc.6", out v));

            SemanticVersion o = new SemanticVersion(0, 1111, 5, new PreRelease(PreReleaseStage.RC, 7), 32);
            Assert.Equal(1, o.CompareTo(v));
        }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:8,代码来源:ParserTest.cs

示例9: semantic_version_comparison

 public void semantic_version_comparison(string first,string second,int result)
 {
     Write("Comparing {0} to {1}. Expecting {2}",first,second,result);
     var v1 = new SemanticVersion(first);
     var v2 = new SemanticVersion(second);
     var rez = v1.CompareTo(v2);
     Write(rez.ToString());
     Assert.Equal(result,rez);
 }
开发者ID:geffzhang,项目名称:cavemantools,代码行数:9,代码来源:SemVersionTests.cs

示例10: SameSemanticVersionNumberIsEqual

        public void SameSemanticVersionNumberIsEqual(ushort major, ushort minor, ushort patch)
        {
            var semVer1 = new SemanticVersion(major, minor, patch);
            var semVer2 = new SemanticVersion(major, minor, patch);

            var expected = 0;
            var actual = semVer1.CompareTo(semVer2);

            Assert.Equal(expected, actual);
        }
开发者ID:cyberzed,项目名称:SemanticVersioning,代码行数:10,代码来源:SemanticVersionComparerTests.cs

示例11: BiggerAlphaNumericPreReleaseYieldsPositiveResult

        public void BiggerAlphaNumericPreReleaseYieldsPositiveResult(SemanticVersionType semVerType)
        {
            var semVer1 = new SemanticVersion(1, 2, 3, new[] { "bb" }, semVerType);
            var semVer2 = new SemanticVersion(1, 2, 3, new[] { "aa" }, semVerType);

            const int expected = 1;

            var actual = semVer1.CompareTo(semVer2);

            Assert.Equal(expected, actual);
        }
开发者ID:cyberzed,项目名称:SemanticVersioning,代码行数:11,代码来源:SemanticVersionComparerTests.cs

示例12: CompareToWithNull

        public void CompareToWithNull()
        {
            // Setup
            var version = new SemanticVersion("1.0.0");

            // Execute
            var result = version.CompareTo(null);

            // Assert
            Assert.IsTrue(result > 0);
        }
开发者ID:jsmunroe,项目名称:Helpers,代码行数:11,代码来源:SemanticVersionTest.cs

示例13: CompareTo_III

        public void CompareTo_III()
        {
            // Setup
            var version1 = new SemanticVersion("1.0.0");
            var version2 = new SemanticVersion("4.15.26-beta6");

            // Execute
            var result = version1.CompareTo(version2);

            // Assert
            Assert.IsTrue(result < 0);
        }
开发者ID:jsmunroe,项目名称:Helpers,代码行数:12,代码来源:SemanticVersionTest.cs

示例14: CompareTo_II

        public void CompareTo_II()
        {
            // Setup
            var version1 = new SemanticVersion("4.15.26-beta6");
            var version2 = new SemanticVersion("4.15.26-beta6");

            // Execute
            var result = version1.CompareTo(version2);

            // Assert
            Assert.AreEqual(0, result);
        }
开发者ID:jsmunroe,项目名称:Helpers,代码行数:12,代码来源:SemanticVersionTest.cs

示例15: SemVerComparesWellWithUnboxing

        public void SemVerComparesWellWithUnboxing(SemanticVersion semVer)
        {
            object input = semVer;

            const int expected = 0;

            var actual = semVer.CompareTo(input);

            Assert.Equal(expected, actual);
        }
开发者ID:cyberzed,项目名称:SemanticVersioning,代码行数:10,代码来源:SemanticVersionComparerTests.cs


注:本文中的SemanticVersion.CompareTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。