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 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));
        }
        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 LetterTileRackTest()
 {
     bool exceptionWasThrown = false;
     try
     {
         LetterTileRack ltr = new LetterTileRack();
     }
     catch (Exception)
     {
         exceptionWasThrown = true;
     }
     Assert.IsFalse(exceptionWasThrown);
 }
        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 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;
        }
        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;
        }