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


C# DateRange.Includes方法代码示例

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


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

示例1: Includes_DateIsBetween_ReturnsTrue

        public void Includes_DateIsBetween_ReturnsTrue()
        {
            DateTime effectiveDate = new DateTime ( 2000, 1, 1 );
            DateTime expirationDate = new DateTime ( 2000, 2, 1 );
            DateTime otherDate = new DateTime ( 2000, 1, 15 );

            DateRange dateRange = new DateRange ( effectiveDate, expirationDate );

            Assert.IsTrue ( dateRange.Includes ( otherDate ) );
        }
开发者ID:divyang4481,项目名称:REM,代码行数:10,代码来源:DateRangeTests.cs

示例2: DetectsADateTimeNotInRange_ReturnsFalse_NoException

        public void DetectsADateTimeNotInRange_ReturnsFalse_NoException()
        {
            DateTime testDate = DateTime.Now;
            DateTime startDate = testDate.AddMonths(months: 1);
            DateTime endDate = testDate.AddMonths(months: 2);

            DateRange range = new DateRange(startDate, endDate);

            var expected = false;
            var actual = range.Includes(testDate);

            Assert.IsTrue(actual == expected, message: "The date is not in the defined range, should have returned false");
        }
开发者ID:Hobb,项目名称:projector,代码行数:13,代码来源:DateRangeTests.cs

示例3: DetectsARangeStartDateIsNotContainedWithinAnotherRange_ReturnsFalse_NoException

        public void DetectsARangeStartDateIsNotContainedWithinAnotherRange_ReturnsFalse_NoException()
        {
            DateTime startDate1 = DateTime.Now;
            DateTime endDate1 = DateTime.Now.AddMonths(months: 1);

            DateTime startDate2 = DateTime.Now.AddDays(value: -7);
            DateTime endDate2 = DateTime.Now.AddDays(value: 2);

            DateRange range1 = new DateRange(startDate1, endDate1);
            DateRange range2 = new DateRange(startDate2, endDate2);

            var expected = false;
            var actual = range1.Includes(range2);

            Assert.IsTrue(actual == expected, message: "The range Start Date is not contained in the defined range, should have returned false");
        }
开发者ID:Hobb,项目名称:projector,代码行数:16,代码来源:DateRangeTests.cs

示例4: Includes_ExpirationIsNull_ReturnsTrue

        public void Includes_ExpirationIsNull_ReturnsTrue()
        {
            DateTime effectiveDate = new DateTime ( 2000, 1, 1 );
            DateTime? expirationDate = null;
            DateTime otherDate = new DateTime ( 2000, 1, 15 );

            DateRange dateRange = new DateRange ( effectiveDate, expirationDate );

            Assert.IsTrue ( dateRange.Includes ( otherDate ) );
        }
开发者ID:divyang4481,项目名称:REM,代码行数:10,代码来源:DateRangeTests.cs

示例5: ComparisonTest

 public void ComparisonTest()
 {
     DateRange sd = new DateRange(d1, d1);
     Assert.IsTrue(sd.Includes(d1.Value.AddHours(12)));
     Assert.IsFalse(sd.Includes(d2.Value));
 }
开发者ID:kailuowang,项目名称:MindLib,代码行数:6,代码来源:DateRangeFixture.cs

示例6: DateRangeDefaultConstructorTest

 public void DateRangeDefaultConstructorTest()
 {
     DateRange target = new DateRange(); // Defaults to infinite range.
     Assert.IsTrue(target.Includes(DateTime.MinValue));
     Assert.IsTrue(target.Includes(DateTime.MaxValue));
 }
开发者ID:asunchu,项目名称:Rolcore,代码行数:6,代码来源:DateRangeTest.cs

示例7: Includes_IsTrueForStartDate

 public void Includes_IsTrueForStartDate()
 {
     var target = new DateRange(DateTime.Today, DateTime.Now);
     Assert.IsTrue(target.Includes(DateTime.Today));
 }
开发者ID:Rollins,项目名称:Rolcore,代码行数:5,代码来源:DateRangeTest.cs

示例8: ConstructorDefault_ConstructsInfiniteDateRange

 public void ConstructorDefault_ConstructsInfiniteDateRange()
 {
     var target = new DateRange(); // Defaults to infinite range.
     Assert.IsTrue(target.Includes(DateTime.MinValue));
     Assert.IsTrue(target.Includes(DateTime.MaxValue));
 }
开发者ID:Rollins,项目名称:Rolcore,代码行数:6,代码来源:DateRangeTest.cs

示例9: Includes_IsTrueForEndDate

 public void Includes_IsTrueForEndDate()
 {
     var now = DateTime.Now;
     var target = new DateRange(DateTime.Today, now);
     Assert.IsTrue(target.Includes(now));
 }
开发者ID:Rollins,项目名称:Rolcore,代码行数:6,代码来源:DateRangeTest.cs

示例10: Includes_IsTrueForDateBetweenStartAndEndDates

 public void Includes_IsTrueForDateBetweenStartAndEndDates()
 {
     var target = new DateRange(DateTime.Today, DateTime.Today.AddDays(1));
     Assert.IsTrue(target.Includes(DateTime.Today.AddHours(12)));
 }
开发者ID:Rollins,项目名称:Rolcore,代码行数:5,代码来源:DateRangeTest.cs

示例11: Includes_IsFalseForDateBeforeEndDate

 public void Includes_IsFalseForDateBeforeEndDate()
 {
     var target = new DateRange(DateTime.Today, DateTime.Now);
     Assert.IsFalse(target.Includes(DateTime.Today.AddMilliseconds(-1)));
 }
开发者ID:Rollins,项目名称:Rolcore,代码行数:5,代码来源:DateRangeTest.cs

示例12: Includes_IsFalseForDateAfterEndDate

 public void Includes_IsFalseForDateAfterEndDate()
 {
     var now = DateTime.Now;
     var target = new DateRange(DateTime.Today, now);
     Assert.IsFalse(target.Includes(now.AddMilliseconds(1)));
 }
开发者ID:Rollins,项目名称:Rolcore,代码行数:6,代码来源:DateRangeTest.cs

示例13: Includes_IsAlwaysTrueForInfiniteRange

 public void Includes_IsAlwaysTrueForInfiniteRange()
 {
     var target = new DateRange();
     Assert.IsTrue(target.Includes(DateTime.Today));
     Assert.IsTrue(target.Includes(DateTime.MinValue));
     Assert.IsTrue(target.Includes(DateTime.MaxValue));
 }
开发者ID:Rollins,项目名称:Rolcore,代码行数:7,代码来源:DateRangeTest.cs


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