public Customer Save(Customer Customer) { // Validar o Nome if (string.IsNullOrWhiteSpace(Customer.CompanyName)) { throw new Exception("Nome de Categoria Invalido"); } // Caso tudo esteja ok return(target.Save(Customer)); }
public Customer Save(Customer Customer) { if (string.IsNullOrWhiteSpace(Customer.CustomerID)) { throw new Exception("Codigo de cliente invalido"); } if (string.IsNullOrWhiteSpace(Customer.CompanyName)) { throw new Exception("Nome de Categoria Invalido"); } return(target.Save(Customer)); }
public void TestSave() { var Customer = new Customer { CustomerID = "123", CompanyName = "Abobrinha" }; target.Save(Customer); var registroDB = target.GetById(Customer.CustomerID); Assert.IsTrue(registroDB.CustomerID == Customer.CustomerID && registroDB.CompanyName == Customer.CompanyName); if (registroDB.CustomerID == Customer.CustomerID && registroDB.CompanyName == Customer.CompanyName) { } }