本文整理汇总了C#中UInt128.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# UInt128.CompareTo方法的具体用法?C# UInt128.CompareTo怎么用?C# UInt128.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UInt128
的用法示例。
在下文中一共展示了UInt128.CompareTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UInt128_CompareTo_UInt128_Equivalent_ReturnsZero
public void UInt128_CompareTo_UInt128_Equivalent_ReturnsZero()
{
var baseValue = new UInt128() { High = 1, Low = 2 };
var testValues = new[] {
baseValue,
new UInt128() { High = 1, Low = 2 }
};
foreach (var testValue in testValues)
{
Assert.Equal(
0,
baseValue.CompareTo(testValue));
}
}
示例2: UInt128_CompareTo_UInt128_InequivalentLess_ReturnsGreaterThanZero
public void UInt128_CompareTo_UInt128_InequivalentLess_ReturnsGreaterThanZero()
{
var baseValue = new UInt128() { High = 1, Low = 2 };
var testValue = new UInt128() { High = 2, Low = 0 };
Assert.True(
baseValue.CompareTo(testValue) > 0);
}
示例3: UInt128_CompareTo_InvalidType_Throws
public void UInt128_CompareTo_InvalidType_Throws()
{
var baseValue = new UInt128() { High = 1, Low = 2 };
Assert.Throws<ArgumentException>(() =>
baseValue.CompareTo((object) 0));
Assert.Throws<ArgumentException>(() =>
baseValue.CompareTo(new object()));
}
示例4: UInt128_CompareTo_InequivalentLess_ReturnsLessThanZero
public void UInt128_CompareTo_InequivalentLess_ReturnsLessThanZero()
{
var baseValue = new UInt128() { High = 1, Low = 2 };
var testValue = (object) new UInt128() { High = 0, Low = 0 };
Assert.True(
baseValue.CompareTo(testValue) < 0);
}
示例5: UInt128_CompareTo_Null_ReturnsGreaterThanZero
public void UInt128_CompareTo_Null_ReturnsGreaterThanZero()
{
var baseValue = new UInt128() { High = 1, Low = 2 };
Assert.True(
baseValue.CompareTo((object) null) > 0);
}