public void GetAllJounrey() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { Assert.AreNotEqual(0, mapper.GetAll().Count); } }
public void GetOneJourneyByID() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { Assert.AreEqual(journeyClassic1.Description, mapper.FindBy(1).Description); } }
public void AddJourneyWithoutDriverUpDateTime() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { mapper.AddorUpdate(journeyWithoutDriverUpDateTime); } }
public void AddEmptyJourney() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { mapper.AddorUpdate(journeyEmpty); } }
public void AddJourneyWithoutFreeSeat() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { Assert.AreNotEqual(0, mapper.AddorUpdate(journeyWithoutFreeSeat)); } }
public void AddJourneyWithoutSartingAddress() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { mapper.AddorUpdate(journeyWithoutStartingAddress); } }
public void AddJourneyWithoutDescription() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { mapper.AddorUpdate(journeyWithoutDescription); } }
public void AddJourneyClassic() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { journeyClassic1 = mapper.AddorUpdate(journeyClassic1); Assert.AreNotEqual(0, journeyClassic1.ID); } }
public void DeleteJourney() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { mapper.Delete(2); Expression <Func <Journey, bool> > expression = j => j.ID == 2; Assert.AreEqual(0, mapper.FindBy(expression).Count); } }
public void UpdateJourney() { using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { journeyClassic4 = mapper.AddorUpdate(journeyClassic4); journeyClassic4.Description = "coucou"; journeyClassic4 = mapper.AddorUpdate(journeyClassic4); Assert.AreEqual("coucou", mapper.FindBy(journeyClassic4.ID).Description); } }
public void AddJounreys() { List <Journey> journeys = new List <Journey> { journeyClassic2, journeyClassic3 }; using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { Assert.AreNotEqual(0, mapper.AddorUpdate(journeys).First().ID); } }
public void GetOneJourneyBysearch() { Journey journey = journeyClassic4; journey.ID = 0; journey.FreeSeat = 10; using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { journey = mapper.AddorUpdate(journey); Expression <Func <Journey, bool> > expression = j => j.Description == journey.Description && j.Driver == journey.Driver; Assert.AreEqual(journey.ID, mapper.FindBy(expression).First().ID); } }
public void UpdateJourneyAddPassenger() { journeyClassic4.ID = 0; journeyClassic4.Description = "trajet 5"; journeyClassic4.Driver = users[1]; using (EFJourneyMapper mapper = new EFJourneyMapper(CONNECTION_STRING)) { journeyClassic4 = mapper.AddorUpdate(journeyClassic4); journeyClassic4.Passengers.Add(users[0]); mapper.AddorUpdate(journeyClassic4); Assert.AreEqual(users[0].Login, mapper.FindBy(journeyClassic4.ID).Passengers.First().Login); } }
public ActionResult AddJourney(Journey journey) { if (ModelState.IsValid) { using (EFJourneyMapper mapper = new EFJourneyMapper("WebProject2017-DBb")) { try { journey.Driver = (User)Session["User"]; journey = mapper.AddorUpdate(journey); return(RedirectToAction("Profil", "Users")); } catch (Exception ex) { ViewBag.MessageErreur = ex.Message; } } } return(View(journey)); }
// GET: Journey public ActionResult SearchJourney() { SearchJourneyViewModel model = new SearchJourneyViewModel(); model.Result = new List <Journey>(); using (EFJourneyMapper mapper = new EFJourneyMapper("WebProject2017-DBb")) { model.Result = mapper.GetAll(); } model.JourneysUser = new List <Journey>(); if (((User)Session["User"]) != null) { foreach (Journey j in model.Result) { if (j.Driver.ID == ((User)Session["User"]).ID) { model.JourneysUser.Add(j); } } } return(View(model)); }