当前位置: 首页>>代码示例>>C#>>正文


C# TimeInterval.GetRelation方法代码示例

本文整理汇总了C#中TimeInterval.GetRelation方法的典型用法代码示例。如果您正苦于以下问题:C# TimeInterval.GetRelation方法的具体用法?C# TimeInterval.GetRelation怎么用?C# TimeInterval.GetRelation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeInterval的用法示例。


在下文中一共展示了TimeInterval.GetRelation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DefaultTest

 public void DefaultTest() {
     TimeInterval timeInterval = new TimeInterval();
     Assert.AreNotEqual(timeInterval, TimeInterval.Anytime);
     Assert.AreEqual(timeInterval.GetRelation(TimeInterval.Anytime), PeriodRelation.ExactMatch);
     Assert.IsTrue(timeInterval.IsAnytime);
     Assert.IsTrue(timeInterval.IsClosed);
     Assert.IsFalse(timeInterval.IsOpen);
     Assert.IsFalse(timeInterval.IsMoment);
     Assert.IsFalse(timeInterval.IsReadOnly);
 }
开发者ID:debop,项目名称:NFramework,代码行数:10,代码来源:TimeIntervalFixture.cs

示例2: TouchingIntervalTest

        public void TouchingIntervalTest() {
            TimeInterval timeInterval1 = new TimeInterval(start, end);
            TimeInterval timeInterval2 = new TimeInterval(end, end.AddHours(1));

            Assert.AreNotEqual(timeInterval1.GetIntersection(timeInterval2), null);
            Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), true);
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
            Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.StartTouching);

            timeInterval1.EndEdge = IntervalEdge.Open;
            Assert.AreEqual(timeInterval1.GetIntersection(timeInterval2), null);
            Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), false);
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);
            Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.After);

            timeInterval1.EndEdge = IntervalEdge.Closed;
            Assert.AreNotEqual(timeInterval1.GetIntersection(timeInterval2), null);
            Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), true);
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
            Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.StartTouching);

            timeInterval2.StartEdge = IntervalEdge.Open;
            Assert.AreEqual(timeInterval1.GetIntersection(timeInterval2), null);
            Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), false);
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);
            Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.After);

            timeInterval2.StartEdge = IntervalEdge.Closed;
            Assert.AreNotEqual(timeInterval1.GetIntersection(timeInterval2), null);
            Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), true);
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
            Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.StartTouching);
        }
开发者ID:debop,项目名称:NFramework,代码行数:33,代码来源:TimeIntervalFixture.cs

示例3: IsIntervalEnabledTest

        public void IsIntervalEnabledTest() {
            TimeInterval timeInterval1 = new TimeInterval(start, end);
            TimeInterval timeInterval2 = new TimeInterval(end, end.AddHours(1));

            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);

            timeInterval1.EndEdge = IntervalEdge.Open;
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);

            timeInterval1.IsIntervalEnabled = false;
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);

            timeInterval1.IsIntervalEnabled = true;
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);

            timeInterval1.EndEdge = IntervalEdge.Closed;
            Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
        }
开发者ID:debop,项目名称:NFramework,代码行数:18,代码来源:TimeIntervalFixture.cs


注:本文中的TimeInterval.GetRelation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。