public void TestDb_Create_AddsToDb() { DbSetUp(); ReviewsController controller = new ReviewsController(db); ItemsController itemController = new ItemsController(dbItem); Item testItem = new Item { ItemId = 7, Description = "Gummi Bears!", Name = "Gummi Bears", Cost = 1 }; Review testReview = new Review { ReviewId = 1, Body = "A Review", Rating = 4, UserName = "******", ItemId = 2 }; itemController.Create(testItem); controller.Create(testReview); var collection = (controller.Index() as ViewResult).ViewData.Model as List <Review>; CollectionAssert.Contains(collection, testReview); db.RemoveAll(); }
public void Dispose() { db.RemoveAll(); db2.RemoveAll(); }
public void Dispose() { db.RemoveAll(); dbProduct.RemoveAll(); }
public void Dispose() { db.RemoveAll(); reviewDb.RemoveAll(); }