public void FirstPlayerMustHave9Cards(Color firstPlayer) { var otherPlayer = firstPlayer == Color.Blue ? Color.Red : Color.Blue; A.CallTo(() => _randomUtils.SingleValue(A <Color> .Ignored, A <Color> .Ignored)).Returns(firstPlayer); var game = _gameBuilder.GetNewGame(); var cards = GetGameCardList(game); Assert.Equal(9, cards.Count(c => c.Color == firstPlayer)); Assert.Equal(8, cards.Count(c => c.Color == otherPlayer)); Assert.Equal(1, cards.Count(c => c.Color == Color.Black)); Assert.Equal(7, cards.Count(c => c.Color == Color.Beige)); }
public Game GetNewGame() { var game = new Game { FirstPlayer = _randomUtils.SingleValue(Color.Blue, Color.Red), Key = _randomUtils.GenerateCode().ToUpper() }; var words = _wordRepository.Get25RandomWords(); var cards = GetListOfCards(game.FirstPlayer, words); _randomUtils.RandomizeList(cards); for (var i = 0; i < 5; i++) { for (var j = 0; j < 5; j++) { game.Cards[i, j] = cards[i + j * 5]; } } return(game); }