Esempio n. 1
0
        public void DeleteTest()
        {
            Hospital v = new Hospital();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v.Name = "P2yWI";
                context.Set <Hospital>().Add(v);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(HospitalVM));

            HospitalVM vm = rv.Model as HospitalVM;

            v         = new Hospital();
            v.ID      = vm.Entity.ID;
            vm.Entity = v;
            _controller.Delete(v.ID.ToString(), null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <Hospital>().Count(), 0);
            }
        }