public void BatchDeleteTest() { Products v1 = new Products(); Products v2 = new Products(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v1.ProductUnitID = AddProductUnit(); v1.ProductTypesID = AddProductTypes(); v1.ProMax = 57; v1.ProMin = 92; v1.ProdName = "db4u"; v1.ProWorkShop = "o6d"; v1.PhotoId = AddFileAttachment(); v1.ProInPrice = 64; v1.ProPrice = 79; v1.ProDesc = "ven0"; v2.ProductUnitID = v1.ProductUnitID; v2.ProductTypesID = v1.ProductTypesID; v2.ProMax = 23; v2.ProMin = 11; v2.ProdName = "tnxR"; v2.ProWorkShop = "WdlG6jf"; v2.PhotoId = v1.PhotoId; v2.ProInPrice = 94; v2.ProPrice = 95; v2.ProDesc = "0hTsBPW"; context.Set <Products>().Add(v1); context.Set <Products>().Add(v2); context.SaveChanges(); } var rv = _controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() }); Assert.IsInstanceOfType(rv, typeof(OkObjectResult)); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data1 = context.Set <Products>().Find(v1.ID); var data2 = context.Set <Products>().Find(v2.ID); Assert.AreEqual(data1.IsValid, false); Assert.AreEqual(data2.IsValid, false); } rv = _controller.BatchDelete(new string[] {}); Assert.IsInstanceOfType(rv, typeof(OkResult)); }