Exemple #1
0
        public void Execute_For_SideTurns_Should_Update_Orientations(IInstruction instruction, IRover rover, Orientations expectedOrientation)
        {
            //arrange
            //act
            instruction.Execute(rover);
            var orientation = rover.GetOrientation();

            //assert
            Assert.Equal(expectedOrientation, orientation.GetOrientationType());
        }
Exemple #2
0
        public void TestMethod_ChangeOrientation_WhenThreeReset()
        {
            //Arrange
            var firstOrietation = PositionsMap.OrientationToNumber["V"];

            Rover = new Rover(1, 2, firstOrietation);

            //Act
            Rover.ExecuteCommands("R1", "R");

            //Asser
            Assert.AreEqual(Rover.GetOrientation(), 0);
        }
Exemple #3
0
        public void TestMethod_DecreaseOrientation_WhenZeroReset()
        {
            //Arrange
            var firstOrietation = PositionsMap.OrientationToNumber["N"];

            Rover = new Rover(1, 2, firstOrietation);

            //Act
            Rover.ExecuteCommands("R1", "L");

            //Asser
            Assert.AreEqual(Rover.GetOrientation(), 3);
        }
Exemple #4
0
 public void Execute(IRover rover)
 {
     rover.UpdateOrientation(rover.GetOrientation().Left());
 }
        public void Execute(IRover rover)
        {
            var targetPosition = rover.GetOrientation().GetDiffrenece() + rover.GetPosition();

            rover.UpdatePosition(targetPosition);
        }