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


C# Rover.SendInstruction方法代码示例

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


在下文中一共展示了Rover.SendInstruction方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: moves_south

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

            rover.SendInstruction(RoverInstruction.M);

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

示例5: 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

示例6: cannot_move_rover_if_it_will_collide_with_another_rover

        public void cannot_move_rover_if_it_will_collide_with_another_rover()
        {
            var mars = new Plateau(new Size(3, 3));
            var rover = new Rover(new Coordinate(1, 1), CameraDirection.North);
            mars.PlaceRover(rover);

            var rover2 = new Rover(new Coordinate(1, 2), CameraDirection.South);
            mars.PlaceRover(rover2);

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


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