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


C# Robot.ProcessCommands方法代码示例

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


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

示例1: Run

        private void Run(IWarehouse warehouse)
        {
            var startPosition = GetRobotStartingPosition();
            var commands = GetRobotCommands();

            var robot = new Robot(warehouse, int.Parse(startPosition[0]), int.Parse(startPosition[1]), char.Parse(startPosition[2].ToUpper()));
            robot.ProcessCommands(commands);
            Console.WriteLine("Robots new position: " + robot.Position);
        }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:9,代码来源:RobotProgram.cs

示例2: RobotTriesToMoveOutsideOfWarehouseShouldNotMove

        public void RobotTriesToMoveOutsideOfWarehouseShouldNotMove()
        {
            var warehouse = new Mock<IWarehouse>();
            warehouse.Setup(w => w.IsValidCoordinate(It.IsAny<int>(), It.IsAny<int>())).Returns(true);
            var robot = new Robot(warehouse.Object, 5, 5, 'N');
            warehouse.Setup(w => w.IsValidCoordinate(It.IsAny<int>(), It.IsAny<int>())).Returns(false);

            robot.ProcessCommands("^");

            Assert.That(robot.Position, Is.EqualTo("5 5 N"));
        }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:11,代码来源:RobotTests.cs

示例3: RobotFollowsCommandSequence_InputTwo

 public void RobotFollowsCommandSequence_InputTwo()
 {
     var robot = new Robot(_warehouse.Object, 3, 3, 'E');
     robot.ProcessCommands("^^>^^>^>>^");
     Assert.That(robot.Position, Is.EqualTo("5 1 E"));
 }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:6,代码来源:RobotTests.cs

示例4: RobotFollowsCommandSequence_InputOne

 public void RobotFollowsCommandSequence_InputOne()
 {
     var robot = new Robot(_warehouse.Object, 1, 2, 'N');
     robot.ProcessCommands("<^<^<^<^^");
     Assert.That(robot.Position, Is.EqualTo("1 3 N"));
 }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:6,代码来源:RobotTests.cs

示例5: RobotFacingNorthTurnsLeftThenMovesForward

 public void RobotFacingNorthTurnsLeftThenMovesForward()
 {
     var robot = new Robot(_warehouse.Object, 1, 0, 'N');
     robot.ProcessCommands("<^");
     Assert.That(robot.Position, Is.EqualTo("0 0 W"));
 }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:6,代码来源:RobotTests.cs

示例6: RobotFacingNorthMovesForwardTwice

 public void RobotFacingNorthMovesForwardTwice()
 {
     var robot = new Robot(_warehouse.Object, 0, 0, 'N');
     robot.ProcessCommands("^^");
     Assert.That(robot.Position, Is.EqualTo("0 2 N"));
 }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:6,代码来源:RobotTests.cs

示例7: RobotFacingMovesForwardOnce

 public string RobotFacingMovesForwardOnce(int x, int y, char orientation)
 {
     var robot = new Robot(_warehouse.Object, x, y, orientation);
     robot.ProcessCommands("^");
     return robot.Position;
 }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:6,代码来源:RobotTests.cs

示例8: RobotTurnsRightWithoutMoving

 public string RobotTurnsRightWithoutMoving(int x, int y, char orientation)
 {
     var robot = new Robot(_warehouse.Object, x, y, orientation);
     robot.ProcessCommands(">");
     return robot.Position;
 }
开发者ID:simonf7070,项目名称:WarehouseRobot,代码行数:6,代码来源:RobotTests.cs


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