本文整理汇总了C#中TimeOfDay.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# TimeOfDay.CompareTo方法的具体用法?C# TimeOfDay.CompareTo怎么用?C# TimeOfDay.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeOfDay
的用法示例。
在下文中一共展示了TimeOfDay.CompareTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanCompareTimes_Instance_Equal
public void CanCompareTimes_Instance_Equal()
{
var t1 = new TimeOfDay(0, 0);
var t2 = new TimeOfDay(0, 0);
var c = t1.CompareTo(t2);
Assert.Equal(0, c);
}
示例2: CanCompareTimes_Object_Equal
public void CanCompareTimes_Object_Equal()
{
var t1 = new TimeOfDay(0, 0);
var t2 = new TimeOfDay(0, 0);
var c = t1.CompareTo((object)t2);
Assert.Equal(0, c);
}
示例3: CanCompareTimes_Object_Null
public void CanCompareTimes_Object_Null()
{
var t = new TimeOfDay();
var c = t.CompareTo(null);
Assert.Equal(1, c);
}
示例4: TestTimeOfDayCompareToInvalidTarget
public void TestTimeOfDayCompareToInvalidTarget()
{
TimeOfDay time = new TimeOfDay(0);
DateTimeOffset now = DateTimeOffset.Now;
Action test = () => time.CompareTo(now);
test.ShouldThrow<ArgumentException>().WithMessage(Strings.TimeOfDay_InvalidCompareToTarget(now));
}