public void ActionIsMove_And_SurfaceIsNotBigEnough__VehiclePositionShouldChange() { const int x = 0; const int y = 0; const CompassDirections direction = CompassDirections.N; var rover = new Rover(x, y, direction); var sut = new RoverContext(_surfaceMock.Object, rover); _surfaceMock.Setup(surface => surface.Contains(It.IsAny <Point>())) .Returns(false); Assert.Throws <VehicleConnectionLostException>(() => sut.Move(VehicleActions.M)); }
public void ActionIsMove_And_SurfaceIsBigEnough__VehiclePositionShouldChange() { const int x = 0; const int y = 0; const CompassDirections direction = CompassDirections.N; var rover = new Rover(x, y, direction); var sut = new RoverContext(_surfaceMock.Object, rover); sut.Move(VehicleActions.M); Assert.Equal(x, sut.Vehicle.CurrentPoint.X); Assert.Equal(y + 1, sut.Vehicle.CurrentPoint.Y); Assert.Equal(direction, sut.Vehicle.Facade); }
public void ActionIsTurn__VehicleTurnMethodWillBeInvoked(VehicleActions vehicleAction, CompassDirections expectedDirection) { const int x = 0; const int y = 0; const CompassDirections direction = CompassDirections.N; var rover = new Rover(x, y, direction); var sut = new RoverContext(_surfaceMock.Object, rover); sut.Move(vehicleAction); Assert.Equal(x, sut.Vehicle.CurrentPoint.X); Assert.Equal(y, sut.Vehicle.CurrentPoint.Y); Assert.Equal(expectedDirection, sut.Vehicle.Facade); }