public void InsertLetterTileTest()
        {
            bool exceptionWasThrown = false;
            LetterTile lt = new LetterTile('A', 1);
            LetterTileRack ltr = new LetterTileRack();

            try
            {
                for (int i = 0; i < 7; ++i)
                {
                    ltr.InsertLetterTile(lt);
                }
            }
            catch (LetterTileRack.InvalidLetterTileInsertionException)
            {
                exceptionWasThrown = true;
            }
            Assert.IsFalse(exceptionWasThrown);

            try
            {
                ltr.InsertLetterTile(lt);
            }
            catch (Exception)
            {
                exceptionWasThrown = true;
            }
            Assert.IsTrue(exceptionWasThrown);
        }
        public void IsNullLetterTileTest()
        {
            LetterTile lt = new LetterTile('n', 0);
            Assert.IsTrue(lt.IsNullLetterTile());

            lt = new LetterTile('A', 1);
            Assert.IsFalse(lt.IsNullLetterTile());
        }
        public void EqualsTest()
        {
            LetterTile lt1 = new LetterTile('A', 1);
            LetterTile lt2 = new LetterTile('A', 1);

            Assert.IsTrue(lt1.Equals(lt2));

            lt2 = new LetterTile('E', 1);
            Assert.IsFalse(lt1.Equals(lt2));

            lt2 = new LetterTile('A', 2);
            Assert.IsFalse(lt1.Equals(lt2));
        }
        public void LetterTileTest()
        {
            bool exceptionWasThrown = false;

            // Test that the null LetterTile can be created.
            LetterTile lt = new LetterTile('n', 0);
            Assert.IsTrue(lt.LetterValue == 'n' && lt.PointValue == 0);

            // Test that a valid LetterTile can be created
            lt = new LetterTile('A', 1);
            Assert.IsTrue(lt.LetterValue == 'A' && lt.PointValue == 1);

            // Test that creating a LetterTile with an invalid LetterValue throws an exception.
            try
            {
                lt = new LetterTile('f', 2);
            }
            catch (LetterTile.InvalidLetterValueException)
            {
                exceptionWasThrown = true;
            }

            Assert.IsTrue(exceptionWasThrown);
            exceptionWasThrown = false;

            // Test that creating a LetterTile with a negative PointValue throws an exception.
            try
            {
                lt = new LetterTile('A', -1);
            }
            catch (LetterTile.InvalidPointValueException)
            {
                exceptionWasThrown = true;
            }

            Assert.IsTrue(exceptionWasThrown);
            exceptionWasThrown = false;

            // Test that creating a LetterTile with a PointValue greater than 10 throws an exception.
            try
            {
                lt = new LetterTile('A', 11);
            }
            catch (LetterTile.InvalidPointValueException)
            {
                exceptionWasThrown = true;
            }

            Assert.IsTrue(exceptionWasThrown);
        }
        public void GetAllLetterTilesTest()
        {
            LetterTileRack ltr = new LetterTileRack();
            LetterTile lt = new LetterTile('A', 1);

            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);

            List<LetterTile> lst = new List<LetterTile>();
            lst = ltr.GetAllLetterTiles();

            Assert.IsTrue(lst.Count == 3);
            Assert.IsTrue(lst[1].Equals(lt));
        }
 /// <summary>
 /// Inserts a LetterTile into the LetterTileRack. Throws InvalidLetterTileInsertionException.
 /// </summary>
 /// <param name="letterTileToBeInserted">The LetterTile that is being inserted into the LetterTileRack.</param>
 public void InsertLetterTile(LetterTile letterTileToBeInserted)
 {
     if (this.containedLetterTileSet.Count == 7)
     {
         throw new InvalidLetterTileInsertionException("The insertion of letter tile with LetterValue == " + letterTileToBeInserted.LetterValue +
             " and PointValue == " + letterTileToBeInserted.PointValue + " is invalid. The LetterTileRack is full.");
     }
     else
     {
         // Inserting a null LetterTile is the equivalent of not inserting anything.
         if (!letterTileToBeInserted.IsNullLetterTile())
         {
             this.containedLetterTileSet.Add(letterTileToBeInserted);
         }
     }
 }
        public void LetterTileCountTest()
        {
            LetterTileRack ltr = new LetterTileRack();
            Assert.IsTrue(ltr.LetterTileCount() == 0);

            LetterTile lt = new LetterTile('A', 1);

            ltr.InsertLetterTile(lt);
            Assert.IsTrue(ltr.LetterTileCount() == 1);

            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            Assert.IsTrue(ltr.LetterTileCount() == 7);

            ltr.PopLetterTile(5);
            Assert.IsTrue(ltr.LetterTileCount() == 6);
        }
        public void IsEmptyTest()
        {
            LetterTile lt = new LetterTile('n', 0);
            GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1);
            Assert.IsTrue(gbs.IsEmpty());

            Assert.IsTrue(gbs.ContainedLetterTile.Equals(lt));

            lt = new LetterTile('A', 1);
            gbs.InsertLetterTile(lt);

            Assert.IsFalse(gbs.IsEmpty());
            Assert.IsFalse(gbs.ContainedLetterTile.Equals(new LetterTile('n', 0)));
        }
 public void InsertLetterTileTest()
 {
     GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1);
     LetterTile lt = new LetterTile('A', 1);
     gbs.InsertLetterTile(lt);
     Assert.IsFalse(gbs.IsEmpty());
 }
 /// <summary>
 /// Removes the contained letter tile from the GameBoardSquare, and returns it.
 /// </summary>
 /// <returns>The LetterTile contained in the GameBoardSquare</returns>
 public LetterTile RemoveLetterTile()
 {
     if (this.containedTile.IsNullLetterTile())
     {
         InvalidGameBoardSquareConfigurationException invalidGameBoardSquareConfiguration = new InvalidGameBoardSquareConfigurationException("Invalid removal of LetterTile from an already empty GameBoardSquare object.");
         throw invalidGameBoardSquareConfiguration;
     }
     else
     {
         LetterTile letterTileToBeReturned = this.containedTile;
         this.containedTile = new LetterTile('n', 0);
         return letterTileToBeReturned;
     }
 }
        public void TestPopTile()
        {
            LetterTileRack ltr = new LetterTileRack();
            LetterTile lt = new LetterTile('A', 1);

            ltr.InsertLetterTile(lt);

            bool exceptionWasThrown = false;
            try
            {
                ltr.PopLetterTile(new LetterTile('E', 1));
            }
            catch
            {
                exceptionWasThrown = true;
            }
            Assert.IsTrue(exceptionWasThrown);
        }
        public void RemoveLetterTileTest()
        {
            GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1);
            LetterTile lt1 = new LetterTile('A', 1);
            gbs.InsertLetterTile(lt1);
            Assert.IsFalse(gbs.IsEmpty());

            LetterTile lt2 = gbs.RemoveLetterTile();
            Assert.IsTrue(gbs.IsEmpty());

            bool exceptionWasThrown = false;
            try
            {
                lt2 = gbs.RemoveLetterTile();
            }
            catch (GameBoardSquare.InvalidGameBoardSquareConfigurationException e)
            {
                exceptionWasThrown = true;
                Assert.IsTrue(e.ToString() == "InvalidGameBoardSquareConfigurationException: Invalid removal of LetterTile from an already empty GameBoardSquare object.");
            }
            Assert.IsTrue(exceptionWasThrown);
        }
 /// <summary>
 /// Inserts a LetterTile object into the GameBoardSquare, unless the GameBoardSquare already contains a LetterTile.
 /// Then it throw an InvalidGameBoardSquareConfigurationException.
 /// </summary>
 /// <param name="letterTileToBeInserted">The letter tile that is being inserted into the GameBoardSquare.</param>
 public void InsertLetterTile(LetterTile letterTileToBeInserted)
 {
     if (this.IsEmpty())
     {
         this.containedTile = letterTileToBeInserted;
     }
     else
     {
         InvalidGameBoardSquareConfigurationException invalidGameBoardSquareConfiguration = new InvalidGameBoardSquareConfigurationException("Invalid insertion of LetterTile object into GameBoardSquareObject.");
         throw invalidGameBoardSquareConfiguration;
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="GameBoardSquare"/> class. Throws InvalidGameBoardSquareConfigurationException.
        /// </summary>
        /// <param name="coordinateX">The private member coordinateX will be set to this value (must be from 0 - 14).</param>
        /// <param name="coordinateY">The private member coordinateY will be set to this value (must be from 0 - 14).</param>
        /// <param name="wordMultiplier">The private member wordMultiplier will be set to this value (must be from 1 - 3,
        /// and must be 1 if letterMultiplier is not 1).</param>
        /// <param name="letterMultiplier">The private member letterMultiplier will be set to this value (must be from 1 - 3,
        /// and must be 1 if wordMultiplier is not 1).</param>
        public GameBoardSquare(int coordinateX, int coordinateY, int wordMultiplier, int letterMultiplier)
        {
            if (coordinateX >= 0 && coordinateX < 15)
            {
                this.coordinateX = coordinateX;
            }
            else
            {
                InvalidGameBoardSquareConfigurationException invalidSquare = new InvalidGameBoardSquareConfigurationException("coordinateX set to " + coordinateX.ToString());
                throw invalidSquare;
            }

            if (coordinateY >= 0 && coordinateY < 15)
            {
                this.coordinateY = coordinateY;
            }
            else
            {
                InvalidGameBoardSquareConfigurationException invalidSquare = new InvalidGameBoardSquareConfigurationException("coordinateY set to " + coordinateY.ToString());
                throw invalidSquare;
            }

            this.isStartSquare = this.coordinateX == 7 && this.coordinateY == 7;

            if (wordMultiplier != 1 && letterMultiplier != 1)
            {
                InvalidGameBoardSquareConfigurationException invalidSquare = new InvalidGameBoardSquareConfigurationException("wordMultiplier = " + wordMultiplier.ToString() + ", and letterMultiplier = " + letterMultiplier.ToString());
                throw invalidSquare;
            }

            if (wordMultiplier < 1 || wordMultiplier > 3)
            {
                InvalidGameBoardSquareConfigurationException invalidSquare = new InvalidGameBoardSquareConfigurationException("wordMultiplier out of bounds (wordMultiplier = " + wordMultiplier.ToString() + ")");
                throw invalidSquare;
            }

            if (letterMultiplier < 1 || letterMultiplier > 3)
            {
                InvalidGameBoardSquareConfigurationException invalidSquare = new InvalidGameBoardSquareConfigurationException("letterMultiplier out of bounds (wordMultiplier = " + letterMultiplier.ToString() + ")");
                throw invalidSquare;
            }

            this.wordMultiplier = wordMultiplier;
            this.letterMultiplier = letterMultiplier;

            this.containedTile = new LetterTile('n', 0);
        }
        /// <summary>
        /// Pops a <see cref="LetterTile"/> from the <see cref="LetterTileRack"/>, and returns it. Throws <see cref="InvalidLetterTileAccessException"/>
        /// if the <see cref="LetterTile"/> was not present in the <see cref="LetterTileRack"/>.
        /// </summary>
        /// <param name="tile"></param>
        /// <returns></returns>
        public LetterTile PopLetterTile(LetterTile tile)
        {
            for (int i = 0; i < this.LetterTileCount(); ++i)
            {
                if (this.containedLetterTileSet[i].Equals(tile))
                {
                    this.containedLetterTileSet.Remove(this.containedLetterTileSet[i]);
                    return tile;
                }
            }

            throw new InvalidLetterTileAccessException("InvalidLetterTileAccess: The LetterTile " + tile.LetterValue.ToString() + ", " + tile.PointValue.ToString() + " could not be found.");
        }
示例#16
0
        /// <summary>
        /// Insert a LetterTile into the bag. Throws InvalidLetterTileInsertionException.
        /// </summary>
        /// <param name="insertedLetterTile">The LetterTile to be inserted into the bag.</param>
        public void InsertLetterTile(LetterTile insertedLetterTile)
        {
            if (this.letterTilePointValues[insertedLetterTile.LetterValue] != insertedLetterTile.PointValue)
            {
                throw new InvalidLetterTileInsertionException("The LetterValue " + insertedLetterTile.LetterValue + " does not match the PointValue " + insertedLetterTile.PointValue.ToString() + ".");
            }

            int countOfInsertedLetterTilesAlreadyPresent = 0;
            foreach (LetterTile lt in this.letterTileSet)
            {
                if (lt.Equals(insertedLetterTile))
                {
                    ++countOfInsertedLetterTilesAlreadyPresent;
                }
            }

            if (countOfInsertedLetterTilesAlreadyPresent >= this.letterTileMaxQuantities[insertedLetterTile.LetterValue])
            {
                throw new InvalidLetterTileInsertionException(insertedLetterTile.LetterValue.ToString());
            }

            this.letterTileSet.Add(insertedLetterTile);
        }
示例#17
0
        /// <summary>
        /// Initialize the letterTileSet to the standard set of Scrabble letter tiles.
        /// </summary>
        private void InitializeLetterTiles()
        {
            // Add 2 blank tiles (0 points each)
            LetterTile lt = new LetterTile(' ', 0);
            this.letterTilePointValues.Add(' ', 0);
            this.letterTileMaxQuantities.Add(' ', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 9 'A' tiles (1 point each).
            lt = new LetterTile('A', 1);
            this.letterTilePointValues.Add('A', 1);
            this.letterTileMaxQuantities.Add('A', 9);
            for (int i = 0; i < 9; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'B' tiles (3 points each).
            lt = new LetterTile('B', 3);
            this.letterTilePointValues.Add('B', 3);
            this.letterTileMaxQuantities.Add('B', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'C' tiles (3 points each).
            lt = new LetterTile('C', 3);
            this.letterTilePointValues.Add('C', 3);
            this.letterTileMaxQuantities.Add('C', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 4 'D' tiles (2 points each).
            lt = new LetterTile('D', 2);
            this.letterTilePointValues.Add('D', 2);
            this.letterTileMaxQuantities.Add('D', 4);
            for (int i = 0; i < 4; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 12 'E' tiles (1 point each).
            lt = new LetterTile('E', 1);
            this.letterTilePointValues.Add('E', 1);
            this.letterTileMaxQuantities.Add('E', 12);
            for (int i = 0; i < 12; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'F' tiles (4 points each).
            lt = new LetterTile('F', 4);
            this.letterTilePointValues.Add('F', 4);
            this.letterTileMaxQuantities.Add('F', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 3 'G' tiles (2 points each).
            lt = new LetterTile('G', 2);
            this.letterTilePointValues.Add('G', 2);
            this.letterTileMaxQuantities.Add('G', 3);
            for (int i = 0; i < 3; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'H' tiles (4 points each).
            lt = new LetterTile('H', 4);
            this.letterTilePointValues.Add('H', 4);
            this.letterTileMaxQuantities.Add('H', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 9 'I' tiles (1 point each).
            lt = new LetterTile('I', 1);
            this.letterTilePointValues.Add('I', 1);
            this.letterTileMaxQuantities.Add('I', 9);
            for (int i = 0; i < 9; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 1 'J' tile (8 points each).
            lt = new LetterTile('J', 8);
            this.letterTilePointValues.Add('J', 8);
            this.letterTileMaxQuantities.Add('J', 1);
            for (int i = 0; i < 1; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 1 'K' tile (5 points each).
            lt = new LetterTile('K', 5);
            this.letterTilePointValues.Add('K', 5);
            this.letterTileMaxQuantities.Add('K', 1);
            for (int i = 0; i < 1; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 4 'L' tiles (1 points each).
            lt = new LetterTile('L', 1);
            this.letterTilePointValues.Add('L', 1);
            this.letterTileMaxQuantities.Add('L', 4);
            for (int i = 0; i < 4; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'M' tiles (3 points each).
            lt = new LetterTile('M', 3);
            this.letterTilePointValues.Add('M', 3);
            this.letterTileMaxQuantities.Add('M', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 6 'N' tiles (1 points each).
            lt = new LetterTile('N', 1);
            this.letterTilePointValues.Add('N', 1);
            this.letterTileMaxQuantities.Add('N', 6);
            for (int i = 0; i < 6; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 8 'O' tiles (1 points each).
            lt = new LetterTile('O', 1);
            this.letterTilePointValues.Add('O', 1);
            this.letterTileMaxQuantities.Add('O', 8);
            for (int i = 0; i < 8; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'P' tiles (3 points each).
            lt = new LetterTile('P', 3);
            this.letterTilePointValues.Add('P', 3);
            this.letterTileMaxQuantities.Add('P', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 1 'Q' tile (10 points each).
            lt = new LetterTile('Q', 10);
            this.letterTilePointValues.Add('Q', 10);
            this.letterTileMaxQuantities.Add('Q', 1);
            for (int i = 0; i < 1; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 6 'R' tiles (1 points each).
            lt = new LetterTile('R', 1);
            this.letterTilePointValues.Add('R', 1);
            this.letterTileMaxQuantities.Add('R', 6);
            for (int i = 0; i < 6; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 4 'S' tiles (1 points each).
            lt = new LetterTile('S', 1);
            this.letterTilePointValues.Add('S', 1);
            this.letterTileMaxQuantities.Add('S', 4);
            for (int i = 0; i < 4; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 6 'T' tiles (1 points each).
            lt = new LetterTile('T', 1);
            this.letterTilePointValues.Add('T', 1);
            this.letterTileMaxQuantities.Add('T', 6);
            for (int i = 0; i < 6; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 4 'U' tiles (1 points each).
            lt = new LetterTile('U', 1);
            this.letterTilePointValues.Add('U', 1);
            this.letterTileMaxQuantities.Add('U', 4);
            for (int i = 0; i < 4; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'V' tiles (4 points each).
            lt = new LetterTile('V', 4);
            this.letterTilePointValues.Add('V', 4);
            this.letterTileMaxQuantities.Add('V', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'W' tiles (4 points each).
            lt = new LetterTile('W', 4);
            this.letterTilePointValues.Add('W', 4);
            this.letterTileMaxQuantities.Add('W', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 1 'X' tile (8 points each).
            lt = new LetterTile('X', 8);
            this.letterTilePointValues.Add('X', 8);
            this.letterTileMaxQuantities.Add('X', 1);
            for (int i = 0; i < 1; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 2 'Y' tiles (4 points each).
            lt = new LetterTile('Y', 4);
            this.letterTilePointValues.Add('Y', 4);
            this.letterTileMaxQuantities.Add('Y', 2);
            for (int i = 0; i < 2; ++i)
            {
                this.letterTileSet.Add(lt);
            }

            // Add 1 'Z' tile (10 points each).
            lt = new LetterTile('Z', 10);
            this.letterTilePointValues.Add('Z', 10);
            this.letterTileMaxQuantities.Add('Z', 1);
            for (int i = 0; i < 1; ++i)
            {
                this.letterTileSet.Add(lt);
            }
        }
        public void RemoveLetterTileTest()
        {
            GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1);
            LetterTile lt1 = new LetterTile('A', 1);
            gbs.InsertLetterTile(lt1);
            Assert.IsFalse(gbs.IsEmpty());

            LetterTile lt2 = gbs.RemoveLetterTile();
            Assert.IsTrue(gbs.IsEmpty());
        }
        public void SquareBracketOperatorTest()
        {
            LetterTileRack ltr = new LetterTileRack();
            LetterTile lt = new LetterTile('A', 1);

            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);

            Assert.IsTrue(ltr[3].Equals(lt));

            bool exceptionWasThrown = false;
            try
            {
                char ch = ltr[4].LetterValue;
            }
            catch (LetterTileRack.InvalidLetterTileAccessException)
            {
                exceptionWasThrown = true;
            }

            Assert.IsTrue(exceptionWasThrown);
            exceptionWasThrown = false;

            try
            {
                char ch = ltr[-1].LetterValue;
            }
            catch (LetterTileRack.InvalidLetterTileAccessException)
            {
                exceptionWasThrown = true;
            }

            Assert.IsTrue(exceptionWasThrown);
            exceptionWasThrown = false;
        }
示例#20
0
 /// <summary>
 /// Compares two <see cref="LetterTile"/> objects, and tells whether they are equal.
 /// </summary>
 /// <param name="other">The <see cref="LetterTile"/> to be compared with this.</param>
 /// <returns>True if this == other. Returns false otherwise.</returns>
 public bool Equals(LetterTile other)
 {
     return this.PointValue == other.PointValue && this.LetterValue == other.LetterValue;
 }
        public void InsertLetterTileTest()
        {
            GameBoardSquare gbs = new GameBoardSquare(0, 0, 1, 1);
            LetterTile lt = new LetterTile('A', 1);
            gbs.InsertLetterTile(lt);
            Assert.IsFalse(gbs.IsEmpty());

            bool exceptionsWasThrown = false;
            try
            {
                gbs.InsertLetterTile(lt);
            }
            catch (GameBoardSquare.InvalidGameBoardSquareConfigurationException e)
            {
                exceptionsWasThrown = true;
                Assert.IsTrue(e.ToString() == "InvalidGameBoardSquareConfigurationException: Invalid insertion of LetterTile object into GameBoardSquareObject.");
            }
            Assert.IsTrue(exceptionsWasThrown);
        }
        public void PopLetterTileTest()
        {
            LetterTileRack ltr = new LetterTileRack();

            LetterTile lt = new LetterTile('A', 1);

            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);
            ltr.InsertLetterTile(lt);

            Assert.IsTrue(ltr.LetterTileCount() == 3);

            LetterTile lt2 = ltr.PopLetterTile(2);
            Assert.IsTrue(ltr.LetterTileCount() == 2);
            Assert.IsTrue(lt2.Equals(lt));

            bool exceptionWasThrown = false;
            try
            {
                ltr.PopLetterTile(-1);
            } catch(LetterTileRack.InvalidLetterTileAccessException)
            {
                exceptionWasThrown = true;
            }

            Assert.IsTrue(exceptionWasThrown);
            exceptionWasThrown = false;

            try
            {
                ltr.PopLetterTile(2);
            }
            catch (LetterTileRack.InvalidLetterTileAccessException)
            {
                exceptionWasThrown = true;
            }

            Assert.IsTrue(exceptionWasThrown);
            exceptionWasThrown = false;
        }
        public void GameStateTest()
        {
            // should be able to create empty game state
            GameState emptyGameState = new GameState();

            var user1 = new Scrabble.PlayerClass.Player(1, "user1");
            emptyGameState.AddPlayer(user1);

            this.AssertPlayerEqual(emptyGameState.PlayerList[0], user1);

            // set up
            Board board = new Board();
            List<Scrabble.PlayerClass.Player> playerList = new List<Scrabble.PlayerClass.Player>();
            Bag tileBag = new Bag();

            var letterTileA = new LetterTile('A', 1);
            var letterTileN = new LetterTile('N', 1);
            var letterTileT = new LetterTile('T', 1);
            var letterTileS = new LetterTile('S', 1);
            List<LetterTile> word = new List<LetterTile> { letterTileA, letterTileN, letterTileT, letterTileS };
            var coordsX = new List<int>() { 6, 7, 8, 9 };
            var coordsY = new List<int>() { 7, 7, 7, 7 };
            Play recentPlay = new Play(word, coordsX, coordsY, 42);

            try
            {
                board.AddPlayToBoard(recentPlay);
            }
            catch (Exception err)
            {
                Assert.Fail();
            }

            for (int i = 1; i <= 3; ++i)
            {
                playerList.Add(new Scrabble.PlayerClass.Player(i, "user" + i));
                playerList[i - 1].AddToScore(i * 10);
            }

            playerList[2].IncrementSkipCount();
            playerList[1].ToggleVote();

            TurnOrder playerOrder = new TurnOrder(playerList);

            GameState gameState = new GameState(board, playerList, tileBag, playerOrder, recentPlay);

            playerList.Add(new Scrabble.PlayerClass.Player(4, "user" + 4));
            playerList[3].AddToScore(4 * 10);

            gameState.AddPlayer(playerList[3]);

            var player5 = new Scrabble.PlayerClass.Player(5, "user" + 5);
            player5.AddToScore(5 * 10);

            gameState.AddPlayer(player5);

            Assert.IsTrue(gameState.PlayerList.Count == 4);

            for (int i = 0; i < playerList.Count; ++i)
            {
                this.AssertPlayerEqual(gameState.PlayerList[i], playerList[i]);
            }

            Assert.IsTrue(board.Equals(gameState.GameBoard));
            Assert.IsTrue(tileBag.Equals(gameState.TileBag));
            Assert.IsTrue(playerOrder.Equals(gameState.PlayerOrder));
            Assert.IsTrue(recentPlay.Equals(gameState.RecentPlay));
        }