本文整理汇总了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));
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例6: SameSemanticVersionIsEqual
public void SameSemanticVersionIsEqual(SemanticVersion semVer)
{
const int expected = 0;
var actual = semVer.CompareTo(semVer);
Assert.Equal(expected, actual);
}
示例7: CompareToWithWrongType
public void CompareToWithWrongType()
{
// Setup
var version = new SemanticVersion("1.0.0");
// Execute
var result = version.CompareTo("This is not a SemanticVersion!");
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例12: CompareToWithNull
public void CompareToWithNull()
{
// Setup
var version = new SemanticVersion("1.0.0");
// Execute
var result = version.CompareTo(null);
// Assert
Assert.IsTrue(result > 0);
}
示例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);
}
示例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);
}
示例15: SemVerComparesWellWithUnboxing
public void SemVerComparesWellWithUnboxing(SemanticVersion semVer)
{
object input = semVer;
const int expected = 0;
var actual = semVer.CompareTo(input);
Assert.Equal(expected, actual);
}