示例#1
0
 public override void Execute(IRover rover, Instruction instruction)
 {
     switch(instruction.GetInstruction())
     {
         case Instruction.TurnLeft:
             rover.SetFacing(West);
             break;
         case Instruction.TurnRight:
             rover.SetFacing(East);
             break;
         case Instruction.MoveForward:
             rover.MoveNorth();
             break;
         default:
             throw new ArgumentException("Incorrect facing code.");
     }
 }