public async Task AddPlayerShouldAddNewPlayer() { var service = ServiceMocker.MockGameService(ServiceMocker.MockDbContext()); var gameId = await service.CreateGameAsync(new Game()); await service.AddPlayerAsync(gameId, new Player { Name = "test" }); var game = await service.GetGameAsync(gameId); Assert.NotEmpty(game.Players); Assert.Equal("test", game.Players.First().Name); }
public async Task CreateGameShouldAddNewGameToDb() { var service = ServiceMocker.MockGameService(ServiceMocker.MockDbContext()); var games = await service.GetAllGamesAsync(); Assert.Empty(games); await service.CreateGameAsync(new Game { Name = "test" }); games = await service.GetAllGamesAsync(); Assert.NotEmpty(games); Assert.Equal("test", games.First().Name); }