public void Can_Miss_Ship() { var grid = new Grid(_mockConfigurationManger.Object); grid.Ships.Add(_validBattleship); var gameService = new GameService(grid); const Enums.Missile expectedResult = Enums.Missile.Miss; gameService.FireMissile("a6"); Assert.AreEqual(expectedResult, gameService.GetGameStatus()); }
public void Can_Not_Fired_At_The_Same_Coordinates_Twice() { var grid = new Grid(_mockConfigurationManger.Object); grid.Ships.Add(_validBattleship); var gameService = new GameService(grid); const Enums.Missile expectedResult = Enums.Missile.AlreadyFiredAt; gameService.FireMissile("a1"); gameService.FireMissile("a1"); Assert.AreEqual(expectedResult, gameService.GetGameStatus()); }
public void Can_Not_Enter_Invalid_Grid_References(string gridReference) { var grid = new Grid(_mockConfigurationManger.Object); var gameService = new GameService(grid); const Enums.Missile expectedResult = Enums.Missile.InvalidCoordinate; gameService.FireMissile(gridReference); Assert.AreEqual(expectedResult, gameService.GetGameStatus()); }
public void Can_Sink_Final_Ship_And_Finish_Game() { var grid = new Grid(_mockConfigurationManger.Object); grid.Ships.Add(_validBattleship); var gameService = new GameService(grid); const Enums.Missile expectedResult = Enums.Missile.AllShipsDestroyed; gameService.FireMissile("a1"); gameService.FireMissile("b1"); gameService.FireMissile("c1"); gameService.FireMissile("d1"); gameService.FireMissile("e1"); Assert.AreEqual(expectedResult, gameService.GetGameStatus()); }