public void CreateOfferTest() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "Get_Offers") .Options; var offers = new List <Offer> { new Offer { JobId = "jobid" }, new Offer { JobId = "jobid" } }; int result; using (var context = new ApplicationDbContext(options)) { context.Offers.AddRange(offers); context.SaveChanges(); IOfferService service = new OfferService(context); var jobs = service.GetJobOffers("jobid"); result = jobs.Count(); } Assert.Equal(2, result); }