Exemplo n.º 1
0
        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 Create(JobOffer jobOffer)
 {
     jobOffer.HrEmail = User.FindFirst("emails").Value;
     _jobOfferData.Create(jobOffer);
     _jobOfferData.Commit();
     return(Json(new { status = "success" }));
     //return RedirectToAction("Index");
 }