public void CrudTest() { var target = new VendorRepository(); foreach (var v in good) { target.Add(v); // create Assert.IsTrue(v.Id > 0); v.Nome = "Updated"; target.Update(v); // update target.Remove(v); // remove } foreach (var v in bad) { try { target.Add(v); // create target.Remove(v); // remove Assert.Fail("Should had thrown a validation exception!"); } catch (Exception e) { Assert.IsInstanceOfType(e, typeof(ValidationException)); } } }
public bool Remove(long id) { return(_vendorRepository.Remove(GetById(id))); }