public void DistrictControllerTest_POST_DELETE() { var d = new District() { Id = 0, Name = "Norway", PrimarySalesperson = new Salesperson() { Id = 4 } }; var countOld = controller.Get().ToList().Count; controller.Post(d); var countNew = controller.Get().ToList().Count; Assert.AreNotEqual(countOld, countNew); d = controller.Get().ToList().SingleOrDefault(x => { return(x.Name.Equals(d.Name) && x.PrimarySalesperson.Id.Equals(d.PrimarySalesperson.Id)); }); controller.Delete(d.Id); countNew = controller.Get().Count(); Assert.AreEqual(countOld, countNew); }