Ejemplo n.º 1
0
        public void GameStartsWhenTwoPlayersAreAdded()
        {
            var sut = new GameSessionService("asdfgh", _gameplayMock.Object);

            _gameplayMock.SetupGet(g => g.PlayerOne).Returns(new Player("Anders", true));
            var state = sut.AddPlayer("Anders");

            Assert.IsFalse(state.IsReady);

            _gameplayMock.SetupGet(g => g.PlayerTwo).Returns(new Player("Edith", false));
            _gameplayMock.Setup(g => g.CanStart()).Returns(true);
            state = sut.AddPlayer("Edith");

            Assert.IsTrue(state.IsReady);
            _gameplayMock.Verify(g => g.AddPlayer(It.IsAny <string>()), Times.Exactly(2));
        }