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


C# Time.Equals方法代码示例

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


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

示例1: Can_Compare_Time

 public void Can_Compare_Time()
 {
     Time t1 = new Time(23,30);
     Time t2 = new Time(23,30);
     Time t3 = new Time(12,00);
     Assert.IsTrue(t1.Equals(t2));
     Assert.IsFalse(t1.Equals(t3));
     Assert.IsTrue(t1 > t3);
     Assert.IsTrue(t3 < t1);
     Assert.IsFalse(t1 > t2);
     Assert.IsTrue(t1 >= t2);
     Assert.IsTrue(t2 >= t1);
 }
开发者ID:ievgeniistepanenko,项目名称:FeetClinic,代码行数:13,代码来源:Time_Tests.cs

示例2: OpEquals

 public void OpEquals()
 {
     var time1 = new Time(3600, TimeUnit.Second);
     var time2 = new Time(1, TimeUnit.Hours);
     var time3 = new Time(120, TimeUnit.Minutes);
     (time1 == time2).ShouldBeTrue();
     (time2 == time1).ShouldBeTrue();
     (time1 == time3).ShouldBeFalse();
     (time3 == time1).ShouldBeFalse();
     time1.Equals(time2)
          .ShouldBeTrue();
     time1.Equals((object)time2)
          .ShouldBeTrue();
     time2.Equals(time1)
          .ShouldBeTrue();
     time2.Equals((object)time1)
          .ShouldBeTrue();
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:18,代码来源:TimeOperators.cs

示例3: Times_With_The_Same_Time_Should_Be_Equal

        public void Times_With_The_Same_Time_Should_Be_Equal()
        {
            var time1 = new Time(1, 30);
            var time2 = new Time(1, 30);

            Assert.Equal(time1, time2);
            Assert.True(time1 == time2);
            Assert.False(time1 != time2);
            Assert.True(time1.Equals(time2));
        }
开发者ID:kcornelis,项目名称:FreelanceManager.NET,代码行数:10,代码来源:TimeTests.cs

示例4: Times_With_Another_Time_Should_Not_Be_Equal

        public void Times_With_Another_Time_Should_Not_Be_Equal()
        {
            var time1 = new Time(1, 30);
            var time2 = new Time(1, 31);
            var time3 = new Time(2, 30);

            Assert.NotEqual(time1, time2);
            Assert.NotEqual(time1, time3);

            Assert.False(time1 == time2);
            Assert.True(time1 != time2);
            Assert.False(time1.Equals(time2));
        }
开发者ID:kcornelis,项目名称:FreelanceManager.NET,代码行数:13,代码来源:TimeTests.cs

示例5: EqualsObjectTest

 public void EqualsObjectTest()
 {
     Time target = new Time(10F);
     object obj = new Time(10F);
     bool expected = true;
     bool actual;
     actual = target.Equals(obj);
     Assert.AreEqual(expected, actual);
 }
开发者ID:rmc00,项目名称:gsf,代码行数:9,代码来源:TimeTest.cs

示例6: EqualsTimeSpanTest

 public void EqualsTimeSpanTest()
 {
     Time target = new Time(10F);
     TimeSpan obj = new TimeSpan(0, 0, 10);
     bool expected = true;
     bool actual;
     actual = target.Equals(obj);
     Assert.AreEqual(expected, actual);
 }
开发者ID:rmc00,项目名称:gsf,代码行数:9,代码来源:TimeTest.cs

示例7: EqualsDoubleTest

 public void EqualsDoubleTest()
 {
     Time target = new Time(10F);
     double obj = 10F;
     bool expected = true;
     bool actual;
     actual = target.Equals(obj);
     Assert.AreEqual(expected, actual);
 }
开发者ID:rmc00,项目名称:gsf,代码行数:9,代码来源:TimeTest.cs

示例8: DateTimeInterop

        public void DateTimeInterop()
        {
            Time t1 = new Time(2000, 1, 2, 3, 4, 5, 6);
            DateTime t2 = new DateTime(2003, 9, 1, 13, 44, 55, 6);
            DateTime t3 = new DateTime(2000, 1, 2, 3, 4, 5, 6);

            t1.Equals(t2).Should().Be.False();
            t2.Equals(t1).Should().Be.False();
            (t1 == t2).Should().Be.False();
            (t2 == t1).Should().Be.False();
            (t1 != t2).Should().Be.True();
            (t2 != t1).Should().Be.True();

            t1.Equals(t3).Should().Be.True();
            t3.Equals(t1).Should().Be.True();
            (t1 == t3).Should().Be.True();
            (t3 == t1).Should().Be.True();
            (t1 != t3).Should().Be.False();
            (t3 != t1).Should().Be.False();
        }
开发者ID:ShaneCastle,项目名称:TeaFiles.Net,代码行数:20,代码来源:TimeTest.cs


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