public void DeleteTest() { PlayerState v = new PlayerState(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.LevelExp = 44; v.MaxLifeTime = 69; v.CurrentLife = 52; v.Energy = 93; v.Money = 7; v.Gold = 55; context.Set <PlayerState>().Add(v); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString()); Assert.IsInstanceOfType(rv.Model, typeof(PlayerStateVM)); PlayerStateVM vm = rv.Model as PlayerStateVM; v = new PlayerState(); 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 <PlayerState>().Count(), 0); } }