Beispiel #1
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");
        }
Beispiel #2
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("?");
        }
Beispiel #3
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");
        }