コード例 #1
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 public void PlayerAddDetonatedMines()
 {
     Player player = new Player("Ivan");
     player.DetonatedMines = 12;
     player.AddDetonatedMines(1);
     Assert.AreEqual(13, player.DetonatedMines);
 }
コード例 #2
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 public void PlayerDetonatedMinesSetterTest()
 {
     string name = "Ivan";
     int expected = 10;
     Player player = new Player(name);
     player.DetonatedMines = expected;
     Assert.AreEqual(expected, player.DetonatedMines);
 }
コード例 #3
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 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");
 }
コード例 #4
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
        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");
        }
コード例 #5
0
ファイル: Engine.cs プロジェクト: huuuskyyy/Teamworks
        /// <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);
        }
コード例 #6
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 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");
 }
コード例 #7
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 public void PlayerAddMove()
 {
     Player player = new Player("Ivan");
     player.AddMove();
     Assert.AreEqual(1, player.MovesCount);
 }
コード例 #8
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 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");
 }
コード例 #9
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
        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);
        }
コード例 #10
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
        public void PlayerRestoreMemento()
        {
            Player player = new Player("Ivan");
            player.DetonatedMines = 12;
            player.MovesCount = 11;
            MementoPlayer mementoPlayer = new MementoPlayer();

            player.LoadMemento(mementoPlayer);
        }
コード例 #11
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 public void PlayerNameSetterTest()
 {
     string name = "Ivan";
     Player player = new Player(name);
     Assert.AreEqual(name, player.Name);
 }
コード例 #12
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
        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");
        }
コード例 #13
0
ファイル: PlayerTest.cs プロジェクト: huuuskyyy/Teamworks
 public void PlayerMovesGreaterThanZero()
 {
     Player player = new Player("Ivan");
     player.MovesCount = 1;
     Assert.AreEqual(1, player.MovesCount);
 }