public void BatchDeleteTest() { Company v1 = new Company(); Company v2 = new Company(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v1.ID = 29; context.Set <Company>().Add(v1); context.Set <Company>().Add(v2); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() }); Assert.IsInstanceOfType(rv.Model, typeof(CompanyBatchVM)); CompanyBatchVM vm = rv.Model as CompanyBatchVM; vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() }; _controller.DoBatchDelete(vm, null); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { Assert.AreEqual(context.Set <Company>().Count(), 2); } }