public void Insert() { var unitOfWork = new GameUnitOfWork(); var service = new GameDomainService(unitOfWork); var game = new Game() { Name = "Test", Price = 100, Category = GameCategory.RPG }; service.Insert(game); unitOfWork.Commit(); //Deve haver ao menos 1 game que o nome inicie com Tes Assert.IsTrue(service.FindByName("Tes").Count > 0); }
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); }
public void Insert() { Console.Clear(); var unitOfWork = new GameUnitOfWork(); var service = new GameDomainService(unitOfWork); Console.WriteLine("Digite o nome >"); string name = Console.ReadLine(); double price; try { Console.WriteLine("Diite o preco >"); price = Convert.ToDouble(Console.ReadLine(), System.Globalization.CultureInfo.InvariantCulture); } catch (Exception e) { Console.WriteLine("O campo preço aceita somente numeros. Operação abortada, tente novamente! >>>" + e.Message); return; } var game = new Game() { Name = name, Price = price, Category = Category() }; service.Insert(game); unitOfWork.Commit(); }