Пример #1
0
        public void DeleteCustomer_FromPOCO()
        {
            using (var cc = new CustomerContext())
            {
                cc.Database.Delete();
                cc.Database.Create();
            }

            var repo = new Left4Edit.Models.Repo.EFCustomerRepo();
            repo.AddCustomer(CreateTestCustomer_EF().First());
            repo.SaveChanges();

            var existingCustomer = repo.GetCustomers().First();
            Customer customerToDelete = new Customer()
            {
                ID = existingCustomer.ID,
                Name = "Test Customer",
                Symbol = "ASA"
            };

            repo.DeleteCustomer(customerToDelete);
            repo.SaveChanges();

            Assert.IsTrue(repo.GetCustomers().Count() == 0);
        }