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