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


C# DateInterval.GetHashCode方法代码示例

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


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

示例1: Equals_EqualValues

 public void Equals_EqualValues()
 {
     LocalDate start = new LocalDate(2000, 1, 1);
     LocalDate end = new LocalDate(2001, 6, 19);
     var interval1 = new DateInterval(start, end, false);
     var interval2 = new DateInterval(start, end, false);
     Assert.AreEqual(interval1, interval2);
     Assert.AreEqual(interval1.GetHashCode(), interval2.GetHashCode());
     Assert.IsTrue(interval1 == interval2);
     Assert.IsFalse(interval1 != interval2);
     Assert.IsTrue(interval1.Equals(interval2)); // IEquatable implementation
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:12,代码来源:DateIntervalTest.cs

示例2: Equals_DifferentCalendars

 public void Equals_DifferentCalendars()
 {
     LocalDate start1 = new LocalDate(2000, 1, 1);
     LocalDate end1 = new LocalDate(2001, 6, 19);
     // This is a really, really similar calendar to ISO, but we do distinguish.
     // TODO: Should we?
     LocalDate start2 = start1.WithCalendar(CalendarSystem.Gregorian);
     LocalDate end2 = end1.WithCalendar(CalendarSystem.Gregorian);
     var interval1 = new DateInterval(start1, end1, false);
     var interval2 = new DateInterval(start2, end2, false);
     Assert.AreNotEqual(interval1, interval2);
     Assert.AreNotEqual(interval1.GetHashCode(), interval2.GetHashCode());
     Assert.IsFalse(interval1 == interval2);
     Assert.IsTrue(interval1 != interval2);
     Assert.IsFalse(interval1.Equals(interval2)); // IEquatable implementation
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:16,代码来源:DateIntervalTest.cs

示例3: Equals_DifferentEnd

 public void Equals_DifferentEnd()
 {
     LocalDate start = new LocalDate(2000, 1, 1);
     LocalDate end1 = new LocalDate(2001, 6, 19);
     LocalDate end2 = new LocalDate(2001, 6, 20);
     var interval1 = new DateInterval(start, end1, false);
     var interval2 = new DateInterval(start, end2, false);
     Assert.AreNotEqual(interval1, interval2);
     Assert.AreNotEqual(interval1.GetHashCode(), interval2.GetHashCode());
     Assert.IsFalse(interval1 == interval2);
     Assert.IsTrue(interval1 != interval2);
     Assert.IsFalse(interval1.Equals(interval2)); // IEquatable implementation
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:13,代码来源:DateIntervalTest.cs

示例4: Equals_SameRangeButNotEquivalent

        public void Equals_SameRangeButNotEquivalent()
        {
            LocalDate start = new LocalDate(2000, 1, 1);
            LocalDate end1 = new LocalDate(2001, 6, 19);
            LocalDate end2 = new LocalDate(2001, 6, 20);
            var interval1 = new DateInterval(start, end1, true);
            var interval2 = new DateInterval(start, end2, false);
            Assert.AreEqual(interval1.Length, interval2.Length);

            Assert.AreNotEqual(interval1, interval2);
            Assert.AreNotEqual(interval1.GetHashCode(), interval2.GetHashCode());
            Assert.IsFalse(interval1 == interval2);
            Assert.IsTrue(interval1 != interval2);
            Assert.IsFalse(interval1.Equals(interval2)); // IEquatable implementation
        }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:15,代码来源:DateIntervalTest.cs

示例5: Equals_DifferentCalendars

 public void Equals_DifferentCalendars()
 {
     LocalDate start1 = new LocalDate(2000, 1, 1);
     LocalDate end1 = new LocalDate(2001, 6, 19);
     // This is a really, really similar calendar to ISO - the dates could differ by week of year,
     // but that's all.
     LocalDate start2 = start1.WithCalendar(CalendarSystem.GetGregorianCalendar(1));
     LocalDate end2 = end1.WithCalendar(CalendarSystem.GetGregorianCalendar(1));
     var interval1 = new DateInterval(start1, end1, false);
     var interval2 = new DateInterval(start2, end2, false);
     Assert.AreNotEqual(interval1, interval2);
     Assert.AreNotEqual(interval1.GetHashCode(), interval2.GetHashCode());
     Assert.IsFalse(interval1 == interval2);
     Assert.IsTrue(interval1 != interval2);
     Assert.IsFalse(interval1.Equals(interval2)); // IEquatable implementation
 }
开发者ID:jackthorley,项目名称:nodatime,代码行数:16,代码来源:DateIntervalTest.cs


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