Exemplo n.º 1
0
        public void DontMoveAndReceiveIfCantReceive()
        {
            SlotSelection           slotSelection        = CreateSlotSelection();
            StubSlotSelectionServer slotSelectionServer1 = CreateSlotSelectionServer(true, true) as StubSlotSelectionServer;
            StubSlotSelectionServer slotSelectionServer2 = CreateSlotSelectionServer(true, false) as StubSlotSelectionServer;

            slotSelection.SelectSlot(slotSelectionServer1);
            slotSelection.SelectSlot(slotSelectionServer2);

            Assert.IsFalse(slotSelectionServer1.TakePieceWasCalled);
            Assert.IsFalse(slotSelectionServer2.ReceivePieceWasCalled);
        }
Exemplo n.º 2
0
        public void SelectingTwoSlotsWillCheckIfTheyCanMoveAndReceivePiece()
        {
            SlotSelection           slotSelection        = CreateSlotSelection();
            StubSlotSelectionServer slotSelectionServer1 = CreateSlotSelectionServer(true, true) as StubSlotSelectionServer;
            StubSlotSelectionServer slotSelectionServer2 = CreateSlotSelectionServer(true, true) as StubSlotSelectionServer;

            slotSelection.SelectSlot(slotSelectionServer1);
            slotSelection.SelectSlot(slotSelectionServer2);

            Assert.IsTrue(slotSelectionServer1.CanMovePieceWasCalled);
            Assert.IsTrue(slotSelectionServer2.CanReceivePieceWasCalled);
        }
Exemplo n.º 3
0
        public void FirstIsMovableAndSecondIsEmpty()
        {
            PieceDestinationController firstPieceDestinationController  = CreatePieceDestinationController();
            PieceDestinationController secondPieceDestinationController = CreatePieceDestinationController();

            firstPieceDestinationController.SetMovable();
            secondPieceDestinationController.SetEmpty();
            SlotSelectionServer slotSelectionServer = new StubSlotSelectionServer(true, false, CreatePieceObject());

            Assert.IsTrue(firstPieceDestinationController.CanMovePiece());
            Assert.IsTrue(secondPieceDestinationController.CanReceivePiece());

            firstPieceDestinationController.TakePiece();
            secondPieceDestinationController.ReceivePieceFromSlot(slotSelectionServer);

            Assert.IsTrue(secondPieceDestinationController.State is MovableState);
            Assert.IsTrue(firstPieceDestinationController.State is EmptyState);
        }