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


C# Rover类代码示例

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


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

示例1: cannot_move_rover

        public void cannot_move_rover()
        {
            var rover = new Rover(new Coordinate(0, 0), CameraDirection.West);
            rover.OnMoving(c => false);

            Assert.Throws<RoverCannotMoveException>(() => rover.SendInstruction(RoverInstruction.M));
        }
开发者ID:lukesmith,项目名称:RoboTest,代码行数:7,代码来源:RoverTests.cs

示例2: TestRoverWrapsAroundPlanetBackward

        public void TestRoverWrapsAroundPlanetBackward()
        {
            var rover = new Rover(new Point { X = -50, Y = 0 }, 'E', stateFactory, planet);
            rover.MoveBackward();

            Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("50,0"));
        }
开发者ID:kevPo,项目名称:MarsRover,代码行数:7,代码来源:FacingEastTests.cs

示例3: when_the_rover_is_created

        public void when_the_rover_is_created()
        {
            var initialPosition = new Position(1, 2, Direction.North);
            var rover = new Rover(initialPosition, _plateau, _instructionHandler);

            "It should set the position".AssertThat(rover.Position, Is.EqualTo(initialPosition));
        }
开发者ID:odw1,项目名称:Katas,代码行数:7,代码来源:RoverTests.cs

示例4: GivenRoverWithDirection

        protected void GivenRoverWithDirection(IDirectionState direction)
        {
            var coordinate = new Coordinate(5, 5);
            var plateau = new Plateau(100, 100);

            Rover = new Rover(plateau, coordinate, direction);
        }
开发者ID:corinblaikie,项目名称:InterviewQuestions,代码行数:7,代码来源:RoverTurnMoveTests.cs

示例5: TestRoverEncountersObstacle

 public void TestRoverEncountersObstacle()
 {
     var planetWithObstacles = new Planet(50, new [] { new Point { X = 3, Y = 3} } );
     var rover = new Rover(new Point(3, 2), 'N', planetWithObstacles);
     var driver = new RoverDriver(rover);
     Assert.That(driver.MoveRover("ffrff"), Is.EqualTo("Rover encountered obstacle at position (3,3), rover stopped at (3,2)."));
 }
开发者ID:kevPo,项目名称:VectorMarsRover,代码行数:7,代码来源:RoverDriverTests.cs

示例6: TestRoverEncountersObstacleOnOtherSideOfXAxis

 public void TestRoverEncountersObstacleOnOtherSideOfXAxis()
 {
     var planetWithObstacles = new Planet(50, new[] { new Point { X = 0, Y = -25 } });
     var rover = new Rover(new Point(0, 25), 'N', planetWithObstacles);
     var driver = new RoverDriver(rover);
     Assert.That(driver.MoveRover("ffrff"), Is.EqualTo("Rover encountered obstacle at position (0,-25), rover stopped at (0,25)."));
 }
开发者ID:kevPo,项目名称:VectorMarsRover,代码行数:7,代码来源:RoverDriverTests.cs

示例7: TestMoveForward

        public void TestMoveForward()
        {
            var rover = new Rover(new Point { X = 0, Y = 0 }, 'E', stateFactory, planet);
            rover.MoveForward();

            Assert.That(rover.GetCurrentPosition().ToString(), Is.EqualTo("1,0"));
        }
开发者ID:kevPo,项目名称:MarsRover,代码行数:7,代码来源:FacingEastTests.cs

示例8: BecauseOf

 public void BecauseOf()
 {
     var input = "LMLMLMLMM";
     var plateau = new Plateau(5, 5);
     var rover = new Rover(new Position(1, 2), "N", plateau);
     _commandProcessorResult = new CommandProcessor().Process(input, rover, plateau);
 }
开发者ID:dmohl,项目名称:CSharpMarsRoverChallenge,代码行数:7,代码来源:When_providing_single_line_input_to_the_command_process_with_two_elements.cs

示例9: Asks_if_deploy_point_is_valid_for_landing_surface

 public void Asks_if_deploy_point_is_valid_for_landing_surface()
 {
     var aPoint = new Point(0, 0);
     mockLandingSurface.Setup(x => x.IsValid(aPoint)).Returns(true);
     var rover = new Rover();
     rover.Deploy(mockLandingSurface.Object, aPoint, CardinalDirection.South);
     mockLandingSurface.Verify(x => x.IsValid(aPoint), Times.Once());
 }
开发者ID:emretiryaki,项目名称:MarsRover,代码行数:8,代码来源:RoverTests.cs

示例10: MoveRoverBackwardFacingSouth

        public void MoveRoverBackwardFacingSouth()
        {
            var rover = new Rover(new Position(1, 1), Direction.S);

            rover.Go(@"b");

            Assert.Equal(new Position(1, 2), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例11: GoingOffTheGridToTheTopWrapsToTheBottom

        public void GoingOffTheGridToTheTopWrapsToTheBottom()
        {
            var rover = new Rover(new Position(1, 99), Direction.N, new Grid(100, 100));

            rover.Go(@"ff");

            Assert.Equal(new Position(1, 1), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例12: GoingOffTheGridToTheRightWrapsToTheLeft

        public void GoingOffTheGridToTheRightWrapsToTheLeft()
        {
            var rover = new Rover(new Position(99, 1), Direction.E, new Grid(100, 100));

            rover.Go(@"f");

            Assert.Equal(new Position(0, 1), rover.RoverState.Position);
        }
开发者ID:vphilomin,项目名称:MarsRover,代码行数:8,代码来源:MarsRoverFixture.cs

示例13: moves_west

        public void moves_west()
        {
            var rover = new Rover(new Coordinate(1, 0), CameraDirection.West);

            rover.SendInstruction(RoverInstruction.M);

            Assert.AreEqual(new Coordinate(0, 0), rover.Coordinate);
        }
开发者ID:lukesmith,项目名称:RoboTest,代码行数:8,代码来源:RoverTests.cs

示例14: cannot_move_rover_outside_of_plateau

        public void cannot_move_rover_outside_of_plateau(int x, int y, CameraDirection cameraDirection)
        {
            var mars = new Plateau(new Size(1, 1));
            var rover = new Rover(new Coordinate(x, y), cameraDirection);
            mars.PlaceRover(rover);

            Assert.Throws<RoverCannotMoveException>(() => rover.SendInstruction(RoverInstruction.M));
        }
开发者ID:lukesmith,项目名称:RoboTest,代码行数:8,代码来源:PlateauTests.cs

示例15: changes_direction

        public void changes_direction(RoverInstruction instruction, CameraDirection initialDirection, CameraDirection expectedDirection)
        {
            var rover = new Rover(new Coordinate(0, 0), initialDirection);

            rover.SendInstruction(instruction);

            Assert.AreEqual(expectedDirection, rover.CameraDirection);
        }
开发者ID:lukesmith,项目名称:RoboTest,代码行数:8,代码来源:RoverTests.cs


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