public void AddCardToHandTest() { var id = "TestPlayerCardAdd"; int gameId = 22; int cardId = 1111; var player = _repository.CreatePlayer(id); // create test player Set deck = new Set(); // create deck for test game Card card = new Card() // create a card and add it { CardId = cardId, }; deck.Cards.Add(card); _repository.AddGame(gameId, deck); // add game to database // Act _service.AddCardToHand(cardId, id); // Assert Assert.Contains(card, player.Hand); // card should be in player's hand }
public Game CreateGame() { Set set = _repository.CreateSet(); if (!_repository.CreateCards(set)) { return(null); } Random random = new Random(); int gameId = random.Next(1000, 9999); while (_repository.GetGame(gameId) != null) { gameId = random.Next(1000, 9999); } if (!_repository.AddGame(gameId, set)) { return(null); } return(_repository.GetGames().Find(g => g.GameId == gameId)); }