public void PlayerAddDetonatedMines() { Player player = new Player("Ivan"); player.DetonatedMines = 12; player.AddDetonatedMines(1); Assert.AreEqual(13, player.DetonatedMines); }
public void PlayerDetonatedMinesSetterTest() { string name = "Ivan"; int expected = 10; Player player = new Player(name); player.DetonatedMines = expected; Assert.AreEqual(expected, player.DetonatedMines); }
public void PlayerDetonatedMinesIfSetterAcceptNegativeValue() { string name = "Ivan"; string message = string.Empty; Player player = new Player(name); Assert.AreEqual(name, player.Name); try { player.DetonatedMines = -1; } catch (ArgumentOutOfRangeException ex) { message = "Error:" + ex.ToString(); Console.WriteLine(message); } StringAssert.Contains(message, "Error"); }
public void PlayerDetonatedMinesIfSetterAcceptGreaterThanMaxValue() { string name = "Ivan"; string message = string.Empty; Player player = new Player(name); Assert.AreEqual(name, player.Name); try { player.DetonatedMines = 101; } catch (ArgumentOutOfRangeException ex) { message = "Error " + ex.ToString(); } StringAssert.Contains(message, "Error"); }
/// <summary> /// Starts the game. /// </summary> /// <param name="isLoadGameChosen">Check if a load game is chosen.</param> private void Initialize(bool isLoadGameChosen) { this.gameSaver = new SaveLoadAPI(); this.gamePlayer = new Player("Pesho"); if (isLoadGameChosen) { this.gameSaver.LoadGame(); this.PlayField = this.InitializeField(this.gameSaver.MementoField.FieldDimension); this.PlayField.LoadMemento(this.gameSaver.MementoField); } else { this.PlayField = this.GetNewField(); } this.CurrentCell = this.PlayField[0, 0]; this.SoundsPlayer = this.GetNewSoundsPlayer(); this.Pointer = new Pointer(this.playField[0, 0].X, this.playField[0, 0].Y); }
public void PlayerIfSetterAcceptEmptyString() { string name = "Ivan"; string message = string.Empty; Player player = new Player(name); Assert.AreEqual(name, player.Name); player.MovesCount = 1; Assert.AreEqual(1, player.MovesCount); try { player.Name = string.Empty; } catch (ArgumentNullException ex) { message = ex.ToString(); } StringAssert.Contains(message, "Error"); }
public void PlayerAddMove() { Player player = new Player("Ivan"); player.AddMove(); Assert.AreEqual(1, player.MovesCount); }
public void PlayerToString() { Player player = new Player("Ivan"); player.DetonatedMines = 12; player.AddDetonatedMines(1); player.AddMove(); Assert.AreEqual("Player: Ivan, Detonated mines: 13, Moves: 1", player.ToString(), "Equals"); }
public void PlayerSaveMemento() { Player player = new Player("Ivan"); player.DetonatedMines = 12; player.MovesCount = 11; MementoPlayer mementoPlayer = player.SaveMemento(); Assert.AreEqual("Ivan", mementoPlayer.Name); Assert.AreEqual(12, mementoPlayer.DetonatedMines); Assert.AreEqual(11, mementoPlayer.MovesCount); }
public void PlayerRestoreMemento() { Player player = new Player("Ivan"); player.DetonatedMines = 12; player.MovesCount = 11; MementoPlayer mementoPlayer = new MementoPlayer(); player.LoadMemento(mementoPlayer); }
public void PlayerNameSetterTest() { string name = "Ivan"; Player player = new Player(name); Assert.AreEqual(name, player.Name); }
public void PlayerMovesLessThanZero() { string message = string.Empty; string name = "Ivan"; Player player = new Player(name); Assert.AreEqual(name, player.Name); player.MovesCount = 1; Assert.AreEqual(1, player.MovesCount); try { player.MovesCount = -1; } catch (ArgumentOutOfRangeException ex) { message = "Error " + ex.ToString(); } StringAssert.Contains(message, "Error"); }
public void PlayerMovesGreaterThanZero() { Player player = new Player("Ivan"); player.MovesCount = 1; Assert.AreEqual(1, player.MovesCount); }