Пример #1
0
        public void AddUpdateGameInningTest()
        {
            Guid seedGameId = SeedGame();

            GameInningDto dto = new GameInningDto()
            {
                GameId       = seedGameId,
                InningNumber = TEST_INNING_NUMBER
            };

            var addResult = GameInning.AddNew(dto);

            Assert.IsTrue(addResult.IsSuccess);

            var item = GameInning.GetGameInning(seedGameId, TEST_INNING_NUMBER);

            Assert.IsNotNull(item);
            Assert.AreEqual(seedGameId, item.GameId);
            Assert.AreEqual(TEST_INNING_NUMBER, item.InningNumber);

            dto.InningNumber = 4;
            addResult        = GameInning.AddNew(dto);
            Assert.IsTrue(addResult.IsSuccess);

            item = GameInning.GetGameInning(seedGameId, inningNumber: 4);

            dto.GameInningId = item.GameInningId;
            dto.DeleteDate   = DateTime.UtcNow;
            var updateResult = GameInning.Update(dto);

            Assert.IsTrue(updateResult.IsSuccess);

            item = GameInning.GetGameInning(seedGameId, inningNumber: 4);
            Assert.IsNotNull(item);
            Assert.IsNotNull(item.DeleteDate);

            dto.DeleteDate = null;
            updateResult   = GameInning.Update(dto);
            Assert.IsTrue(updateResult.IsSuccess);

            item = GameInning.GetGameInning(seedGameId, inningNumber: 4);
            Assert.IsNotNull(item);
            Assert.IsNull(item.DeleteDate);

            var items = GameInning.GetGameInnings(seedGameId);

            Assert.IsTrue(items.Count >= 1);

            foreach (var i in items)
            {
                var removeResult = GameInning.Remove(i.GameId, i.InningNumber);
                Assert.IsTrue(removeResult.IsSuccess);
            }

            items = GameInning.GetGameInnings(seedGameId);
            Assert.IsTrue(items.Count == 0);

            DeleteSeededGame(seedGameId);
        }
Пример #2
0
        public void DeleteSeededGameInning(Guid gameInningId)
        {
            var gameInning = GameInning.GetGameInning(gameInningId);

            GameInning.Remove(gameInning.GameId, gameInning.InningNumber);
            DeleteSeededGame(gameInning.GameId);
        }
Пример #3
0
        public void GameNextInningTest()
        {
            Guid gameInningId = SeedGameInning();

            var gameInning = GameInning.GetGameInning(gameInningId);

            Assert.IsNotNull(gameInning);

            int nextInning = GameInning.GetNextGameInningNumber(gameInning.GameId);

            Assert.AreEqual(nextInning, 2);

            DeleteSeededGameInning(gameInningId);
        }