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


C# DateRange.Equals方法代码示例

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


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

示例1: Equals_ReturnsTrueForEquivelantStartAndEndDates

        public void Equals_ReturnsTrueForEquivelantStartAndEndDates()
        {
            var start = DateTime.Today;
            var end = DateTime.Now;
            var target = new DateRange(start, end);
            var other = new DateRange(start, end);

            Assert.AreEqual(true, target.Equals(other));
        }
开发者ID:Rollins,项目名称:Rolcore,代码行数:9,代码来源:DateRangeTest.cs

示例2: Equals_ReturnsFalseForEquivelantStartAndDifferentEndDates

        public void Equals_ReturnsFalseForEquivelantStartAndDifferentEndDates()
        {
            var start = DateTime.Today;
            var end1 = start.AddMilliseconds(1);
            var end2 = start.AddMilliseconds(2);
            var target = new DateRange(start, end1);
            var other = new DateRange(start, end2);

            Assert.AreEqual(false, target.Equals(other));
        }
开发者ID:Rollins,项目名称:Rolcore,代码行数:10,代码来源:DateRangeTest.cs

示例3: Equals_ReturnsFalseForDifferentStartAndEquivelantEndDates

        public void Equals_ReturnsFalseForDifferentStartAndEquivelantEndDates()
        {
            var start1 = DateTime.Today;
            var start2 = DateTime.Today.AddMilliseconds(1);
            var end = DateTime.Now;
            var target = new DateRange(start1, end);
            var other = new DateRange(start2, end);

            Assert.AreEqual(false, target.Equals(other));
        }
开发者ID:Rollins,项目名称:Rolcore,代码行数:10,代码来源:DateRangeTest.cs

示例4: Equals_GivenVariousScenarios_ReturnsAsExpected

        public void Equals_GivenVariousScenarios_ReturnsAsExpected()
        {
            DateRange first;
            DateRange second;

            first = new DateRange(null, null);
            second = new DateRange(null, null);
            Assert.IsTrue(first.Equals(second));

            first = new DateRange(null, null);
            second = new DateRange(DateTime.Now, null);
            Assert.IsFalse(first.Equals(second));

            DateTime dateTime = DateTime.Now;
            first = new DateRange(dateTime, null);
            second = new DateRange(dateTime, null);
            Assert.IsTrue(first.Equals(second));
        }
开发者ID:divyang4481,项目名称:REM,代码行数:18,代码来源:DateRangeTests.cs

示例5: EqualsTest

        public void EqualsTest()
        {
            DateRange target = new DateRange();
            DateRange other = new DateRange();

            bool expected = true;
            bool actual = target.Equals(other);
            Assert.AreEqual(expected, actual);

            other = new DateRange(DateTime.Today, DateTime.Now);
            actual = target.Equals(other);
            expected = false;
            Assert.AreEqual(expected, actual);
        }
开发者ID:asunchu,项目名称:Rolcore,代码行数:14,代码来源:DateRangeTest.cs

示例6: GetIntersectionTest

        public void GetIntersectionTest()
        {
            var target = new DateRange(DateTime.Today.AddDays(-1), DateTime.Today);
            var otherTarget = new DateRange(DateTime.Today, DateTime.Today.AddDays(1));
            var expectedIntersection = new DateRange(DateTime.Today, DateTime.Today);

            Assert.IsTrue(expectedIntersection.Equals(target.GetIntersection(otherTarget)));
        }
开发者ID:asunchu,项目名称:Rolcore,代码行数:8,代码来源:DateRangeTest.cs

示例7: GetWorkingDaysCount

		public static int GetWorkingDaysCount(DateRange dateRange)
		{
			return !dateRange.Equals(DateRange.Empty)
				? GetWorkingDaysCount(dateRange.StartDate.Value, dateRange.EndDate.Value)
				: 0;
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:6,代码来源:DateUtils.cs

示例8: Equals_ReturnsTrueForInifiniteDateRanges

        public void Equals_ReturnsTrueForInifiniteDateRanges()
        {
            var target = new DateRange();
            var other = new DateRange();

            Assert.AreEqual(true, target.Equals(other));
        }
开发者ID:Rollins,项目名称:Rolcore,代码行数:7,代码来源:DateRangeTest.cs

示例9: Equal_DateRangeWithDifferentStartAndSameEndDates_ReturnFalse

        public void Equal_DateRangeWithDifferentStartAndSameEndDates_ReturnFalse()
        {
            // Arrange
            DateTime t1 = DateTime.Now;
            DateTime t2 = t1.AddHours(1);
            DateTime t3 = t1.AddHours(3);
            var dateRange1 = new DateRange(t1, t3);
            var dateRange2 = new DateRange(t2, t3);

            // Act
            bool result = dateRange1.Equals(dateRange2);

            // Assert
            Assert.False(result);
        }
开发者ID:danieladacruz,项目名称:Orcomp,代码行数:15,代码来源:DateRangeTest.cs

示例10: Equal_DateRangeWithSameStartAndEndDates_ReturnTrue

        public void Equal_DateRangeWithSameStartAndEndDates_ReturnTrue()
        {
            // Arrange
            DateTime t1 = DateTime.Now;
            DateTime t2 = t1.AddHours(1);
            var dateRange1 = new DateRange(t1, t2);
            var dateRange2 = new DateRange(t1, t2);

            // Act
            bool result = dateRange1.Equals( dateRange2 );

            // Assert
            Assert.True(result);
        }
开发者ID:danieladacruz,项目名称:Orcomp,代码行数:14,代码来源:DateRangeTest.cs


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