public void Check_DatabaseWorking() { IJobOfferData db = null; var client = _factory.WithWebHostBuilder(builder => { builder.ConfigureServices(services => { var serviceProvider = services.BuildServiceProvider(); db = serviceProvider.GetRequiredService <IJobOfferData>(); }); }).CreateClient(); var testString = "TestJobOffer"; var offers = db.GetAll().Where(o => o.Name == testString); foreach (var jobOffer in offers) { db.Delete(jobOffer.JobOfferId); } var offer = new JobOffer(0, testString, "desc"); db.Create(offer); db.Commit(); Assert.Contains(db.GetAll(), o => o.Name == testString); }
public IActionResult Index() { var offers = _jobOfferData.GetAll(); return(View(offers)); }