本文整理汇总了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);
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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;
}
示例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;
}