public void BatchDeleteTest() { Area v1 = new Area(); Area v2 = new Area(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v1.AreaName = "AyD9qo"; v1.ParentId = AddParent(); v2.AreaName = "bLt4Lg7Ll"; v2.ParentId = v1.ParentId; context.Set <Area>().Add(v1); context.Set <Area>().Add(v2); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() }); Assert.IsInstanceOfType(rv.Model, typeof(AreaBatchVM)); AreaBatchVM vm = rv.Model as AreaBatchVM; vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() }; _controller.DoBatchDelete(vm, null); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data1 = context.Set <Area>().Find(v1.ID); var data2 = context.Set <Area>().Find(v2.ID); Assert.AreEqual(data1, null); Assert.AreEqual(data2, null); } }