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


C# DateInterval.Contains方法代码示例

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


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

示例1: Contains_DifferentCalendar

 public void Contains_DifferentCalendar()
 {
     var start = new LocalDate(2000, 1, 1);
     var end = new LocalDate(2014, 06, 30);
     var interval = new DateInterval(start, end);
     var candidate = new LocalDate(2000, 1, 1, JulianCalendar);
     Assert.Throws<ArgumentException>(() => interval.Contains(candidate));
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:8,代码来源:DateIntervalTest.cs

示例2: DateInterval

        public void Contains_CurrentIntervalStartAndEndValuesAreTheSameAsOtherIntervalButDifferentEndPointInclusion_ReturnFalse(
            bool minInclusive1, bool maxInclusive1,
            bool minInclusive2, bool maxInclusive2)
        {
            // Arrange
            var dateInterval = new DateInterval(now, inThreeHours, minInclusive1, maxInclusive1);
            var otherInterval = new DateInterval(now, inThreeHours, minInclusive2, maxInclusive2);

            // Act
            bool contains = dateInterval.Contains(otherInterval);

            // Assert
            Assert.False(contains);
        }
开发者ID:Orcomp,项目名称:Orcomp,代码行数:14,代码来源:DateIntervalTest.cs

示例3: Contains

 public void Contains(string candidateText, bool expectedInclusive, bool expectedExclusive)
 {
     var start = new LocalDate(2000, 1, 1);
     var end = new LocalDate(2014, 06, 30);
     var candidate = LocalDatePattern.IsoPattern.Parse(candidateText).Value;
     var interval = new DateInterval(start, end, true);
     Assert.AreEqual(expectedInclusive, interval.Contains(candidate));
     interval = new DateInterval(start, end, false);
     Assert.AreEqual(expectedExclusive, interval.Contains(candidate));
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:10,代码来源:DateIntervalTest.cs

示例4: Contains_DateOnStartDateInterval_ReturnTrue

        public void Contains_DateOnStartDateInterval_ReturnTrue()
        {
            // Arrange
            var dateInterval = new DateInterval(now, inOneHour);

            // Act
            bool interesct = dateInterval.Contains(now);

            // Assert
            Assert.True(interesct);
        }
开发者ID:Orcomp,项目名称:Orcomp,代码行数:11,代码来源:DateIntervalTest.cs

示例5: Contains_DateOnEndDateInterval_ReturnFalse

        public void Contains_DateOnEndDateInterval_ReturnFalse()
        {
            // Arrange
            var dateInterval = new DateInterval(now, inOneHour);

            // Act
            bool interesct = dateInterval.Contains(inOneHour);

            // Assert
            Assert.False(interesct);
        }
开发者ID:Orcomp,项目名称:Orcomp,代码行数:11,代码来源:DateIntervalTest.cs

示例6: Contains_DateOnEndDateIntervalEndDateInclusive_ReturnTrue

        public void Contains_DateOnEndDateIntervalEndDateInclusive_ReturnTrue()
        {
            // Arrange
            var dateInterval = new DateInterval(now, inOneHour, isMaxInclusive: true);

            // Act
            bool interesct = dateInterval.Contains(inOneHour);

            // Assert
            Assert.True(interesct);
        }
开发者ID:Orcomp,项目名称:Orcomp,代码行数:11,代码来源:DateIntervalTest.cs

示例7: Contains_DateBeforeDateInterval_ReturnFalse

        public void Contains_DateBeforeDateInterval_ReturnFalse()
        {
            // Arrange
            var dateInterval = new DateInterval(now, inOneHour);

            // Act
            bool intersect = dateInterval.Contains(now.AddHours(-1));

            // Assert
            Assert.False(intersect);
        }
开发者ID:Orcomp,项目名称:Orcomp,代码行数:11,代码来源:DateIntervalTest.cs

示例8: Contains_CurrentIntervalStartsBeforeAndFinishedAfterOtherInterval_ReturnTrue

        public void Contains_CurrentIntervalStartsBeforeAndFinishedAfterOtherInterval_ReturnTrue()
        {
            // Arrange
            var dateInterval = new DateInterval(now, inThreeHours);
            var otherInterval = new DateInterval(inOneHour, inTwoHours);

            // Act
            bool contains = dateInterval.Contains(otherInterval);

            // Assert
            Assert.True(contains);
        }
开发者ID:Orcomp,项目名称:Orcomp,代码行数:12,代码来源:DateIntervalTest.cs


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