public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <PrintTieEndsGameAction>()
                                              .Add <ReturnTieEndsGameAction>();

            //Act
            TieEndsGameAction subject = new TieEndsGameAction();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
Ejemplo n.º 2
0
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <HumanFirstPlayerTurn>()
                                              .Add <ComputerFirstPlayerTurn>();

            //Act
            PlayerTurnsOrderAction subject = new PlayerTurnsOrderAction();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <HumanVsComputerGameModeSelectionAction>()
                                              .Add <HumanVsHumanGameModeSelectionAction>()
                                              .Add <ComputerVsComputerGameModeSelectionAction>();
            //Act
            GameModeSelectionAction subject = new GameModeSelectionAction();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
Ejemplo n.º 4
0
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <CurrentPlayerWinningSelectMoveAction>()
                                              .Add <RandomSpaceSelectMoveAction>();

            //Act
            EasyComputerSelectMoveAction subject = new EasyComputerSelectMoveAction();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
        public void ShouldAcceptCustomNames()
        {
            //Arrange
            ChainValidation subject = new ChainValidation();

            subject.Add <LinkC>().Add <LinkA>("_someOtherName");

            //Act
            Action action = () => subject.AssertExpectedChain(new LinkCustom());

            //Assert
            action.Should().Throw <Exception>().WithMessage("Expected [name=_someOtherName] to be of [type=LinkA] but found [type=LinkB]");
        }
        public void ShouldThrowGivenInvalidChain()
        {
            //Arrange
            ChainValidation subject = new ChainValidation();

            subject.Add <LinkA>().Add <LinkA>();

            //Act
            Action action = () => subject.AssertExpectedChain(new LinkHead());

            //Assert
            action.Should().Throw <Exception>().WithMessage("Expected [name=_nextAction] to be of [type=LinkA] but found [type=LinkB]");
        }
        public void ShouldNotThrowGivenValidChain()
        {
            //Arrange
            ChainValidation subject = new ChainValidation();

            subject.Add <LinkA>().Add <LinkB>();

            //Act
            Action action = () => subject.AssertExpectedChain(new LinkHead());

            //Assert
            action.Should().NotThrow();
        }
Ejemplo n.º 8
0
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <EasyDifficultySelectionAction>()
                                              .Add <MediumDifficultySelectionAction>()
                                              .Add <HardDifficultySelectionAction>();

            //Act
            DifficultySelectionAction subject = new DifficultySelectionAction();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <CountdownTimerUpdateAction_GuardAgainstNoMore>()
                                              .Add <CountdownTimerUpdateAction_DefaultForeColor>()
                                              .Add <CountdownTimerUpdateAction_RemainingTime>()
                                              .Add <NoOpUpdateAction>();

            //Act
            CountdownTimerUpdateAction_TimerRunning subject = new CountdownTimerUpdateAction_TimerRunning();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
Ejemplo n.º 10
0
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <CountdownTimerElapsedAction_FinishedGuard>()
                                              .Add <CountdownTimerElapsedAction_LastGuard>()
                                              .Add <CountdownTimerElapsedAction_Update>()
                                              .Add <CountdownTimerElapsedAction.NoOp>();

            //Act
            CountdownTimerElapsedAction subject = new CountdownTimerElapsedAction();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <GameOverGuardPlayerEndsGameAction>()
                                              .Add <TakeTurnPlayerEndsGameAction>()
                                              .Add <PrintBoardPlayerEndsGameAction>()
                                              .Add <NoWinGuardPlayerEndsGameAction>()
                                              .Add <PrintWinPlayerEndsGameAction>()
                                              .Add <DefaultPlayerEndsGameAction>();

            //Act
            PlayerEndsGameAction subject = new PlayerEndsGameAction();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }
Ejemplo n.º 12
0
        public void ShouldHaveExpectedOrder()
        {
            //Arrange
            ChainValidation chainValidation = new ChainValidation()
                                              .Add <CountdownTimerUpdateAction_GuardAgainstMore>()
                                              .Add <CountdownTimerUpdateAction_FinishedForeColor>()
                                              .Add <CountdownTimerUpdateAction_RemainingTime>()
                                              .Add <CountdownTimerUpdateAction_EnableSessionStart>()
                                              .Add <CountdownTimerUpdateAction_ShowSessionStart>()
                                              .Add <CountdownTimerUpdateAction_HideShortBreakStart>()
                                              .Add <CountdownTimerUpdateAction_ShowShortBreakOver>()
                                              .Add <CountdownTimerUpdateAction_FormToTop>()
                                              .Add <NoOpUpdateAction>();

            //Act
            ShortBreakTimerUpdateAction_TimerFinished subject = new ShortBreakTimerUpdateAction_TimerFinished();

            //Assert
            chainValidation.AssertExpectedChain(subject);
        }