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


C# Location.CompareTo方法代码示例

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


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

示例1: check_that_the_CompareTo_method_works

        public void check_that_the_CompareTo_method_works()
        {
            Location loc1 = new Location(5, 6);
              Location loc2 = new Location(5, 6);
              Location loc3 = new Location(7, 5);
              Location loc4 = new Location(6, 5);
              Location loc5 = new Location(6, 6);
              Location loc6 = new Location(6, 4);

              Specify.That(loc1.CompareTo(loc2)).ShouldEqual(0);
              Specify.That(loc1.CompareTo(loc3)).ShouldEqual(-1);
              Specify.That(loc1.CompareTo(loc4)).ShouldEqual(-1);
              Specify.That(loc3.CompareTo(loc4)).ShouldEqual(1);
              Specify.That(loc4.CompareTo(loc5)).ShouldEqual(-1);
              Specify.That(loc4.CompareTo(loc6)).ShouldEqual(1);
        }
开发者ID:iamjwc,项目名称:fightin-zigbees,代码行数:16,代码来源:location_test.cs

示例2: CompareLocation_SameXandY_ResturnsSame

        public void CompareLocation_SameXandY_ResturnsSame()
        {
            //Arrange
            Location location1 = new Location(100, 500);
            Location location2 = new Location(100, 500);

            //Act

            //Assert
            Assert.AreEqual(0, location1.CompareTo(location2));
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:11,代码来源:LocationTests.cs

示例3: CompareLocation_SmallXVsLargeX_ResturnsSmaller

        public void CompareLocation_SmallXVsLargeX_ResturnsSmaller()
        {
            //Arrange
            Location location1 = new Location(100, 100);
            Location location2 = new Location(200, 100);

            //Act

            //Assert
            Assert.AreEqual(-1, location1.CompareTo(location2));
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:11,代码来源:LocationTests.cs

示例4: CompareLocation_LargeYVsSmallY_ResturnsSmaller

        public void CompareLocation_LargeYVsSmallY_ResturnsSmaller()
        {
            //Arrange
            Location location1 = new Location(100, 500);
            Location location2 = new Location(100, 100);

            //Act

            //Assert
            Assert.AreEqual(1, location1.CompareTo(location2));
        }
开发者ID:shaneinsweden,项目名称:RobotCleaner,代码行数:11,代码来源:LocationTests.cs


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