本文整理汇总了C#中TimeRange.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# TimeRange.Contains方法的具体用法?C# TimeRange.Contains怎么用?C# TimeRange.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeRange
的用法示例。
在下文中一共展示了TimeRange.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhenTimeIsNotWithinRangeContainsShouldReturnFalse
public void WhenTimeIsNotWithinRangeContainsShouldReturnFalse()
{
Time time = new Time(12, 02);
TimeRange range = new TimeRange(new Time(11, 00), new Time(12, 01));
Assert.False(range.Contains(time));
time = new Time(19, 58);
range = new TimeRange(new Time(19, 59), new Time(19, 57));
Assert.False(range.Contains(time));
}
示例2: WhenTimeIsWithinRangeContainsShouldReturnTrue
public void WhenTimeIsWithinRangeContainsShouldReturnTrue()
{
Time time = new Time(12, 00);
TimeRange range = new TimeRange(new Time(11, 00), new Time(12, 01));
Assert.True(range.Contains(time));
time = new Time(11, 02);
Assert.True(range.Contains(time));
time = new Time(04, 00);
range = new TimeRange(new Time(21, 00), new Time(05, 00));
Assert.True(range.Contains(time));
range = new TimeRange(new Time(00, 00), new Time(23, 59));
time = new Time(23, 59);
Assert.True(range.Contains(time));
time = new Time(00, 00);
Assert.True(range.Contains(time));
time = new Time(00, 01);
Assert.True(range.Contains(time));
time = new Time(12, 00);
Assert.True(range.Contains(time));
}