public void BuildingNewGaShouldAssignRandomKey()
        {
            A.CallTo(() => _randomUtils.GenerateCode()).Returns("some-code");

            var game = _gameBuilder.GetNewGame();

            Assert.Equal("SOME-CODE", game.Key);
        }
Example #2
0
        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);
        }