public void ShuffleTest()
        {
            var deck = new FiniteDeck(6);
            Tile test_tile = new MockTile();
            deck.Enqueue(test_tile);
            deck.Shuffle(50);
            Tile[] array = deck.ToArray();

            var deck2 = new FiniteDeck(6);

            deck2.Enqueue(test_tile);
            deck2.Shuffle(50);
            Tile[] array2 = deck2.ToArray();

            //CollectionAssert.AreEqual(array, array2);

            int compare_value1 = -1;

            for (int i = 0; i<array.Length; i++)
                if (array[i] == test_tile)
                    compare_value1 = i;

            int compare_value2 = -1;
            for (int i = 0; i<array2.Length; i++)
                if (array2[i] == test_tile)
                    compare_value2 = i;

            Assert.AreEqual(compare_value1, compare_value2);
        }
        public void AddSingleTileScoreTest()
        {
            Tile tile = new MockTile();
            _control.PlaceTile(tile, _control.GetPlacableSpaces().First());

            Assert.AreEqual(tile.Worth, _control.ActivePlayer.CalculateScore());
        }
 public void PushPopTest()
 {
     var deck = new FiniteDeck(6);
     Tile test_tile = new MockTile();
     deck.Push(test_tile);
     Assert.AreEqual(deck.Pop(), test_tile);
 }
 public void PlaceTileTest()
 {
     Tile tile = new MockTile();
     Space space = _control.Board.Edges.First();
     _control.PlaceTile(tile, space);
     ReferenceEquals(space.Tile, tile);
     ReferenceEquals(tile, space.Tile);
 }
        public void TestNewTileIsPlaced()
        {
            var target = new Quarry();
            Tile tile = new MockTile();
            Space space = _control.GetPlacableSpaces(tile).First();

            target.Transition(null);
            target.Transition(tile);
            target.Transition(space);

            Assert.AreEqual(tile, space.Tile);
        }
        public void TransitionTest()
        {
            var target = new Quarry();
            Tile tile = new MockTile();

            Selection actual = target.Transition(null);
            Assert.AreEqual(Selection.TileFromHand, actual);

            actual = target.Transition(tile);
            Assert.AreEqual(Selection.PlayableSpace, actual);

            target.Transition(_control.GetPlacableSpaces(tile).First());
            Assert.AreEqual(tile, _control.ActiveTile);
        }
        public void TransitionTest()
        {
            var target = new Graveyard();

            Tile tile = new MockTile();

            _control.PlaceTile(tile, _control.GetPlacableSpaces().First());
            _control.PlaceTile(target, tile.Space.AdjacentSpaces.First());

            Selection actual = target.Transition(null);
            Assert.AreEqual(Selection.TileFromBoard, actual);

            actual = target.Transition(tile);
            Assert.AreEqual(Selection.None, actual);

            Assert.AreEqual(null, tile.Space);

            Assert.IsTrue(_control.ActivePlayer.Hand.Contains(tile));
        }
        public void MultipleRemoveToken()
        {
            //place the grove
            var grove = new Grove();
            _control.PlaceTile(grove, _control.GetPlacableSpaces(grove).First());

            //place a target tile to remove tokens from
            Tile tile = new MockTile();

            _control.PlaceTile(tile, _control.GetPlacableSpaces(tile).First());

            //start grove
            grove.Transition(null);
            try
            {
                grove.Transition(tile);
                grove.Transition(tile);
                Assert.Fail("Expected an Exception");
            }
            catch (ArgumentException) {}
        }
        public void CanOnlyRemoveYourTokens()
        {
            //place the grove
            var grove = new Grove();
            _control.PlaceTile(grove, _control.GetPlacableSpaces(grove).First());

            //place a target tile to remove tokens from
            Tile tile = new MockTile();

            _control.PlaceTile(tile, _control.GetPlacableSpaces(tile).First());

            //start grove
            Selection actual = grove.Transition(null);
            Assert.AreEqual(Selection.TileFromBoard, actual);

            _control.ActivePlayer = _control.Players.Where(player => player != _control.ActivePlayer).First();
            try
            {
                grove.Transition(tile);
                Assert.Fail("Expected an Exception");
            }
            catch (ArgumentException) {}
        }
        public void RemoveTestTile()
        {
            Tile tile = new MockTile();

            Space space = _control.GetPlacableSpaces(tile).First();
            _control.PlaceTile(tile, space);
            _control.RemoveTile(tile);

            Assert.AreEqual(tile.Space, null);
            Assert.AreEqual(space.Tile, null);
        }
        public void TilePlacementTest()
        {
            var board = new Board();

            Space space = board[0, 0];
            var tile = new MockTile {Space = space};

            Assert.AreSame(space, tile.Space);
            Assert.AreSame(tile, space.Tile);
        }