public void CreateMarsRover_Should_Create_Mars_Rover_When_Expected_Position() { //Arrange var plateauService = new Mock <IPlateauService>(); plateauService.Setup(foo => foo.GetCurrentPlateau()).Returns(new PlateauModel { Width = 5, Height = 5 }); var roverPositionModel = new RoverPositionModel { X = 1, Y = 3, Direction = Direction.East }; //Act var marsRoverService = new MarsRoverService(_loggerMock); marsRoverService.CreateMarsRover(roverPositionModel, plateauService.Object); var currentRoverPositionModel = marsRoverService.GetCurrentRover(); //Assert currentRoverPositionModel.X.Should().Be(roverPositionModel.X); currentRoverPositionModel.Y.Should().Be(roverPositionModel.Y); currentRoverPositionModel.Direction.Should().Be(roverPositionModel.Direction); }
public void CreateMarsRover_Should_Throw_InvalidPosition_When_Negative_Or_Extreme(int x, int y, Direction direction) { //Arrange var plateauService = new Mock <IPlateauService>(); plateauService.Setup(foo => foo.GetCurrentPlateau()).Returns(new PlateauModel { Width = 5, Height = 5 }); var roverPositionModel = new RoverPositionModel { X = x, Y = y, Direction = direction }; var marsRoverService = new MarsRoverService(_loggerMock); //Act void Action() { marsRoverService.CreateMarsRover(roverPositionModel, plateauService.Object); } //Assert Assert.Throws <ValidateMarsRoverPositionException>((Action)Action); }