public void AddUpdateGameTeamTest() { Guid seedGameId = SeedGame(); Guid seedTeamId = SeedTeam(); GameTeamDto dto = new GameTeamDto() { GameId = seedGameId, TeamId = seedTeamId }; var addResult = GameTeam.AddNew(dto); Assert.IsTrue(addResult.IsSuccess); var item = GameTeam.GetGameTeam(seedGameId, seedTeamId); Assert.IsNotNull(item); Assert.AreEqual(seedTeamId, item.TeamId); Assert.AreEqual(seedGameId, item.GameId); dto.GameTeamId = item.GameTeamId; dto.DeleteDate = DateTime.UtcNow; var updateResult = GameTeam.Update(dto); Assert.IsTrue(updateResult.IsSuccess); item = GameTeam.GetGameTeam(seedGameId, seedTeamId); Assert.IsNotNull(item); Assert.IsNotNull(item.DeleteDate); dto.DeleteDate = null; updateResult = GameTeam.Update(dto); Assert.IsTrue(updateResult.IsSuccess); var items = GameTeam.GetGameTeams(seedGameId); Assert.IsTrue(items.Count >= 1); item = items.FirstOrDefault(x => x.TeamId == seedTeamId); Assert.IsNotNull(item); var removeResult = GameTeam.Remove(seedGameId, seedTeamId); Assert.IsTrue(removeResult.IsSuccess); item = GameTeam.GetGameTeam(seedGameId, seedTeamId); Assert.IsNull(item); DeleteSeededGame(seedGameId); DeleteSeededTeam(seedTeamId); }
public Guid SeedGameTeam() { Guid gameTeamId = Guid.NewGuid(); Guid seedGameId = SeedGame(); Guid seedTeamId = SeedTeam(); GameTeamDto dto = new GameTeamDto() { GameTeamId = gameTeamId, GameId = seedGameId, TeamId = seedTeamId }; GameTeam.AddNew(dto); return(gameTeamId); }