예제 #1
0
        public void CreateNewGame_TwoPlayers_Succeeds()
        {
            var input = new BingoGameCreationModel()
            {
                Name    = "Pearl Jam",
                Players = new List <PlayerModel>()
                {
                    new PlayerModel()
                    {
                        Name = "Eddie Vedder"
                    },
                    new PlayerModel()
                    {
                        Name = "Mike McCready"
                    }
                },
                Size = 3
            };

            _bingoCardLogicMock.Setup(logic => logic.GenerateBingoCard(It.IsAny <BingoCardCreationModel>())).Returns(new BingoCardModel()
            {
                Name = "Pearl Jam",
                Grid = new int?[][]
                {
                    new int?[] { 1, 2, 3 },
                    new int?[] { 4, 5, 6 },
                    new int?[] { 7, 8, 9 }
                }
            });

            _bingoNumberLogicMock.Setup(logic => logic.GetNextNumber()).Returns(1);

            var actual = _bingoGameLogic.CreateNewGame(input);

            Assert.Equal(2, actual.Players.Count());
            Assert.Equal("Eddie Vedder", actual.Players.First().Name);
            Assert.Equal(3, actual.Players.First().BingoCard.Grid.Length);
        }
예제 #2
0
        public ActionResult CreateBingoGame([FromBody] BingoGameCreationModel gameCreationModel)
        {
            var bingoGameModel = _bingoGameLogic.CreateNewGame(gameCreationModel);

            return(Ok(bingoGameModel));
        }