Пример #1
0
        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);
        }
Пример #2
0
        public void DeleteSeededGameTeam(Guid gameTeamId)
        {
            var gameTeam = GameTeam.GetGameTeam(gameTeamId);

            GameTeam.Remove(gameTeam.GameId, gameTeam.TeamId);
            DeleteSeededGame(gameTeam.GameId);
            DeleteSeededTeam(gameTeam.TeamId);
        }