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


C# Rover.Move方法代码示例

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


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

示例1: AsARoverIShouldDecrementMyXPositionWhenMovingToWest

        public void AsARoverIShouldDecrementMyXPositionWhenMovingToWest()
        {
            var rover = new Rover(new West(), new Coordinate("1 0"), _terrain);

            rover.Move();

            Assert.AreEqual("0 0 W", rover.Position);
        }
开发者ID:marcellalves,项目名称:marsrover,代码行数:8,代码来源:RoverTest.cs

示例2: AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainUpperBoundaryXAxisValue

        public void AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainUpperBoundaryXAxisValue()
        {
            var rover = new Rover(new East(), new Coordinate("1 0"), _terrain);

            rover.Move();

            Assert.AreEqual("1 0 E", rover.Position);
        }
开发者ID:marcellalves,项目名称:marsrover,代码行数:8,代码来源:RoverTest.cs

示例3: AsARoverIShouldIncrementMyYPositionWhenMovingToNorth

        public void AsARoverIShouldIncrementMyYPositionWhenMovingToNorth()
        {
            var rover = new Rover(new North(), new Coordinate("0 0"), _terrain);

            rover.Move();

            Assert.AreEqual("0 1 N", rover.Position);
        }
开发者ID:marcellalves,项目名称:marsrover,代码行数:8,代码来源:RoverTest.cs

示例4: AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainLowerBoundaryXAxisValue

        public void AsARoverIShouldRaiseAnExceptionBeforeMovingToAInvalidTerrainLowerBoundaryXAxisValue()
        {
            var terrain = new Terrain(new Coordinate("1 1"));
            var rover = new Rover(new West(), new Coordinate("0 0"), _terrain);

            rover.Move();

            Assert.AreEqual("0 0 W", rover.Position);
        }
开发者ID:marcellalves,项目名称:marsrover,代码行数:9,代码来源:RoverTest.cs

示例5: AsARoverIShouldRaiseAnExceptionBeforeMovingToInvalidTerrainLowerBoundaryYAxisValue

        public void AsARoverIShouldRaiseAnExceptionBeforeMovingToInvalidTerrainLowerBoundaryYAxisValue()
        {
            var rover = new Rover(new South(), new Coordinate("0 0"), _terrain);

            rover.Move();

            Assert.AreEqual("0 0 S", rover.Position);
        }
开发者ID:marcellalves,项目名称:marsrover,代码行数:8,代码来源:RoverTest.cs

示例6: Alters_position_and_direction_in_response_to_movement_list

            public void Alters_position_and_direction_in_response_to_movement_list(int startX, int startY, 
                CardinalDirection startDirection, Movement firstMove, Movement secondMove, Movement thirdMove, 
                int expectedX, int expectedY, CardinalDirection expectedDirection)
            {
                var startPosition = new Point(startX, startY);
                var expectedPosition = new Point(expectedX, expectedY);
                var movements = new List<Movement> {firstMove, secondMove, thirdMove};

                var mockLandingSurface = new Mock<ILandingSurface>();
                mockLandingSurface.Setup(x => x.IsValid(startPosition)).Returns(true);

                var rover = new Rover();
                rover.Deploy(mockLandingSurface.Object, startPosition, startDirection);
                rover.Move(movements);

                Assert.AreEqual(expectedPosition.X, rover.Position.X);
                Assert.AreEqual(expectedPosition.Y, rover.Position.Y);
                Assert.AreEqual(expectedDirection, rover.CardinalDirection);
            }
开发者ID:emretiryaki,项目名称:MarsRover,代码行数:19,代码来源:RoverTests.cs

示例7: Execute

 public void Execute(Rover rover)
 {
     rover.Move();
 }
开发者ID:marcellalves,项目名称:marsrover,代码行数:4,代码来源:MoveCommand.cs

示例8: Move_InitialStateIs00E_FinalStateShouldBe10E

        public void Move_InitialStateIs00E_FinalStateShouldBe10E()
        {
            // Arrange
            var rover = new Rover();
            var initialCoordinates = new Coordinates(0, 0);
            rover.Init(initialCoordinates, new EastOrientation());

            // Act
            rover.Move();

            //Assert
            Assert.That(rover.Coordinates, Is.EqualTo(new Coordinates(1, 0)));
        }
开发者ID:jruizx,项目名称:MarsRoversProblem,代码行数:13,代码来源:RoverTests.cs

示例9: Move_InitialStateIs55NAndPlateauIsSetTo55_OutOfPlateauException

        public void Move_InitialStateIs55NAndPlateauIsSetTo55_OutOfPlateauException()
        {
            // Arrange
            var rover = new Rover();
            var initialCoordinates = new Coordinates(5, 5);
            rover.Init(initialCoordinates, new NorthOrientation());

            var upperLeft = new Coordinates(5, 5);
            var plateau = new Plateau(upperLeft);

            rover.SetPlateau(plateau);

            // Act
            rover.Move();
        }
开发者ID:jruizx,项目名称:MarsRoversProblem,代码行数:15,代码来源:RoverTests.cs

示例10: Move_InitialStateIs33WAndPlateauIsSetTo55_TheNewCoordinatesShouldBe23W

        public void Move_InitialStateIs33WAndPlateauIsSetTo55_TheNewCoordinatesShouldBe23W()
        {
            // Arrange
            var rover = new Rover();
            var initialCoordinates = new Coordinates(3, 3);
            rover.Init(initialCoordinates, new WestOrientation());

            var upperLeft = new Coordinates(5, 5);
            var plateau = new Plateau(upperLeft);

            rover.SetPlateau(plateau);

            // Act
            rover.Move();

            // Assert
            Assert.That(rover.Coordinates, Is.EqualTo(new Coordinates(2, 3)));
            Assert.That(rover.Orientation, Is.EqualTo(new WestOrientation()));
        }
开发者ID:jruizx,项目名称:MarsRoversProblem,代码行数:19,代码来源:RoverTests.cs


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