本文整理匯總了C#中System.Result.CompareTo方法的典型用法代碼示例。如果您正苦於以下問題:C# Result.CompareTo方法的具體用法?C# Result.CompareTo怎麽用?C# Result.CompareTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Result
的用法示例。
在下文中一共展示了Result.CompareTo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestCompareToEqualResults
public void TestCompareToEqualResults()
{
Result result1 = new Result(5, "Goran");
Result result2 = new Result(5, "Alex");
int actual = result1.CompareTo(result2);
Assert.AreEqual(0, actual, "Compare equal results failed!");
}
示例2: TestCompareToThisGreaterThanArgument
public void TestCompareToThisGreaterThanArgument()
{
Result result1 = new Result(5, "Goran");
Result result2 = new Result(4, "Alex");
int actual = result1.CompareTo(result2);
Assert.AreEqual(1, actual, "Compare first result greater than second should return 1!");
}
示例3: TestCompareToArgumentGreaterThanThis
public void TestCompareToArgumentGreaterThanThis()
{
Result result1 = new Result(2, "Goran");
Result result2 = new Result(4, "Alex");
int actual = result1.CompareTo(result2);
Assert.AreEqual(-1, actual, "Compare second result greater than first should return -1!");
}