public void testAddBid() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "Add_bid_to_db") .Options; int price = 230; string description = "This is how much you owe me"; var start = new DateTime(2017 / 01 / 12); var end = new DateTime(2017 / 01 / 12); Bid bid = new Bid(); bid.bidPrice = price; bid.description = description; bid.startDate = start; bid.endDate = end; using (ApplicationDbContext context = new ApplicationDbContext(options)) { IBidRepository bidRepo = new BidRepository(context); bidRepo.AddBid(bid); bidRepo.Save(); } // Use a separate instance of the context to verify correct data was saved to database using (var context = new ApplicationDbContext(options)) { IBidRepository bidRepo = new BidRepository(context); var bidRecieved = bidRepo.GetBidByID(bid.bidId); Assert.True(bidRecieved.bidPrice == price); } }