public void Moving_Out_Of_Range_Throws_Exception(string instruction) { //Arrange var dron = new Dron(0, 0, 'S', _forest); //Act & Assert Assert.Throws <GameException>(() => dron.ExecuteInstructions(instruction)); }
public void Moving_East_As_Expected() { //Arrange var dron = new Dron(1, 1, 'E', _forest); //Act dron.ExecuteInstructions("M"); //Assert Assert.Equal <int>(2, dron.X); }
public void Moving_South_As_Expected() { //Arrange var dron = new Dron(0, 1, 'S', _forest); //Act dron.ExecuteInstructions("M"); //Assert Assert.Equal <int>(0, dron.Y); }
private void ExecuteInstruction(string instruction) { string[] splitedInstruction = instruction.Split(' '); switch (splitedInstruction.Length) { case (int)InstructionEnum.MoveDronInstruction: _dron.ExecuteInstructions(instruction); break; case (int)InstructionEnum.SetDronPositionInstruction: SetDronInitialPosition(splitedInstruction); break; case (int)InstructionEnum.SetForestDimensionInstruction: SetForestDimensions(splitedInstruction); break; default: throw new GameException("Invalid Instruction"); } }