本文整理汇总了C#中TimeRange.IsSamePeriod方法的典型用法代码示例。如果您正苦于以下问题:C# TimeRange.IsSamePeriod方法的具体用法?C# TimeRange.IsSamePeriod怎么用?C# TimeRange.IsSamePeriod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeRange
的用法示例。
在下文中一共展示了TimeRange.IsSamePeriod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSamePeriodTest
public void IsSamePeriodTest() {
var schoolDay = new SchoolDay();
TimeRange manualRange = new TimeRange(schoolDay.Start, schoolDay.End);
Assert.IsTrue(schoolDay.IsSamePeriod(schoolDay));
Assert.IsTrue(schoolDay.IsSamePeriod(manualRange));
Assert.IsTrue(manualRange.IsSamePeriod(schoolDay));
Assert.IsFalse(schoolDay.IsSamePeriod(TimeBlock.Anytime));
Assert.IsFalse(manualRange.IsSamePeriod(TimeBlock.Anytime));
schoolDay.RemoveAt(0);
Assert.IsFalse(schoolDay.IsSamePeriod(manualRange));
Assert.IsFalse(manualRange.IsSamePeriod(schoolDay));
}
示例2: IsSamePeriodTest
public void IsSamePeriodTest() {
var timeRange1 = new TimeRange(_start, _end);
var timeRange2 = new TimeRange(_start, _end);
Assert.IsTrue(timeRange1.IsSamePeriod(timeRange1));
Assert.IsTrue(timeRange2.IsSamePeriod(timeRange2));
Assert.IsTrue(timeRange1.IsSamePeriod(timeRange2));
Assert.IsTrue(timeRange2.IsSamePeriod(timeRange1));
Assert.IsFalse(timeRange1.IsSamePeriod(TimeRange.Anytime));
Assert.IsFalse(timeRange2.IsSamePeriod(TimeRange.Anytime));
timeRange1.Move(new TimeSpan(1));
Assert.IsFalse(timeRange1.IsSamePeriod(timeRange2));
Assert.IsFalse(timeRange2.IsSamePeriod(timeRange1));
timeRange1.Move(new TimeSpan(-1));
Assert.IsTrue(timeRange1.IsSamePeriod(timeRange2));
Assert.IsTrue(timeRange2.IsSamePeriod(timeRange1));
}