public void Delete()
        {
            var unitOfWork = new GameUnitOfWork();
            var service = new GameDomainService(unitOfWork);

            var game = new Game()
            {
                Name = "Delete",
                Price = 100,
                Category = GameCategory.RPG
            };

            service.Insert(game);
            unitOfWork.Commit();

            //Deve haver 1 registro (adicionado acima)
            Assert.IsTrue(service.FindByName("Delet").Count > 0);

            service.Delete(game);
            unitOfWork.Commit();

            //Nao deve haver registros
            Assert.IsTrue(service.FindByName("Delet").Count == 0);
        }
Пример #2
0
        public void Delete()
        {
            Console.Clear();

            var unitOfWork = new GameUnitOfWork();
            var service = new GameDomainService(unitOfWork);

            var game = Find();

            if (game == null)
            {
                Console.WriteLine("Nenhum registro encontrado!");
                return;
            }

            service.Delete(game);
            unitOfWork.Commit();
        }