Example #1
0
        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));
                }
            }
        }
Example #2
0
 public bool Remove(long id)
 {
     return(_vendorRepository.Remove(GetById(id)));
 }