コード例 #1
0
        public void Run()
        {
            _starting.DisplayWelcome();

            IPlayersTurns playersTurns = _gameModeSelection.Select().ConfigurePlayers(_board);

            _starting.DisplayInitialBoard(_board);

            while (playersTurns.GameOver().Not())
            {
            }

            _ending.Display();
        }
コード例 #2
0
        public void ShouldReturnPlayersTurns()
        {
            //Arrange
            FakePlayer                 fakePlayer         = new FakePlayer.Builder().Build();
            FakePlayerCreation         fakePlayerCreation = new FakePlayerCreation.Builder().Player(fakePlayer).Build();
            FakeBoard                  fakeBoard          = new FakeBoard.Builder().Build();
            ComputerVsComputerGameMode subject            = new ComputerVsComputerGameMode(fakePlayerCreation);

            //Act
            IPlayersTurns actual = subject.ConfigurePlayers(fakeBoard);

            //Assert
            actual.Should().BeOfType <PlayersTurns>();
            fakePlayerCreation.PlayerInvokedWith("O");
            fakePlayerCreation.PlayerInvokedWith("X");
        }
コード例 #3
0
        public void ShouldReturnPlayersTurns()
        {
            //Arrange
            FakeCell             fakeCell           = new FakeCell.Builder().Value("?").Build();
            FakePlayer           fakePlayer         = new FakePlayer.Builder().Cell(fakeCell).Build();
            FakePlayer           fakePlayer2        = new FakePlayer.Builder().Build();
            FakePlayerCreation   fakePlayerCreation = new FakePlayerCreation.Builder().Player(fakePlayer, fakePlayer2).Build();
            FakeBoard            fakeBoard          = new FakeBoard.Builder().Build();
            HumanVsHumanGameMode subject            = new HumanVsHumanGameMode(fakePlayerCreation, fakePlayerCreation);

            //Act
            IPlayersTurns actual = subject.ConfigurePlayers(fakeBoard);

            //Assert
            actual.Should().BeOfType <PlayersTurns>();
            fakePlayerCreation.PlayerInvokedWith("");
            fakePlayerCreation.PlayerInvokedWith("?");
        }
コード例 #4
0
        public void ShouldReturnPlayersTurnsComputerAsX()
        {
            //Arrange
            FakeCell   fakeCell           = new FakeCell.Builder().Value("O").Build();
            FakePlayer fakePlayer         = new FakePlayer.Builder().Cell(fakeCell).Build();
            FakePlayer fakePlayerComputer = new FakePlayer.Builder().Build();
            FakeValidResponse <IPlayerOrder> fakeValidResponse = new FakeValidResponse <IPlayerOrder> .Builder().Response(new HumanFirstOrder()).Build();

            FakePlayerCreation      fakePlayerCreation = new FakePlayerCreation.Builder().Player(fakePlayer, fakePlayerComputer).Build();
            FakeBoard               fakeBoard          = new FakeBoard.Builder().Build();
            HumanVsComputerGameMode subject            = new HumanVsComputerGameMode(fakeValidResponse, fakePlayerCreation, fakePlayerCreation);

            //Act
            IPlayersTurns actual = subject.ConfigurePlayers(fakeBoard);

            //Assert
            actual.Should().BeOfType <PlayersTurns>();
            fakePlayerCreation.PlayerInvokedWith("");
            fakePlayerCreation.PlayerInvokedWith("X");
        }
コード例 #5
0
 public Builder ConfigurePlayers(IPlayersTurns expected)
 {
     _configurePlayersItem.UpdateInvocation(expected);
     return(this);
 }