public ActionResult Specials() { AdminSpecialsVM VM = new AdminSpecialsVM(); var repo = new SpecialRepositoryADO(); VM.Specials = repo.ReadAllSpecials(); return(View(VM)); }
public void CanLoadSpecials() { var repo = new SpecialRepositoryADO(); var specials = repo.GetSpecials(); Assert.AreEqual(5, specials.Count()); Assert.AreEqual(1, specials[0].SpecialID); Assert.AreEqual("Zombie Special", specials[2].SpecialTitle); }
public void CanLoadSpecials() { var repo = new SpecialRepositoryADO(); var specials = repo.GetAll(); Assert.AreEqual(3, specials.Count); Assert.AreEqual("Prius Lease", specials[2].Title); Assert.AreEqual("Bring your car for service today! Alignment only $99.99!", specials[1].SpecialDescription); Assert.AreEqual(1, specials[0].SpecialID); }
public void CantLoadSpecials() { var repo = new SpecialRepositoryADO(); var specials = repo.GetAll(); Assert.AreEqual(1, specials[0].SpecialId); Assert.AreEqual("OneTime", specials[0].SpecialName); Assert.AreEqual("One time deal", specials[0].SpecialText); //CHECK OUT VIDEO 7 }
public void CanLoadSpecials() { var repo = new SpecialRepositoryADO(); List <Special> special = repo.GetAll(); Assert.AreEqual(3, special.Count()); Assert.AreEqual("2", special[2].SpecialId); Assert.AreEqual("FallSale", special[2].SpecialName); Assert.AreEqual("This is the Fall Sale", special[2].SpecialText); }
public void CanAddSpecial() { Special specialToAdd = new Special(); var repo = new SpecialRepositoryADO(); specialToAdd.Title = "The Greatest Sale Ever!"; specialToAdd.SpecialDescription = "We're offering 50% off all used vehicles until the end of the day!"; specialToAdd.UserID = "00000000-0000-0000-0000-000000000000"; repo.Insert(specialToAdd); Assert.AreEqual(4, specialToAdd.SpecialID); }
public void CanCreateFailCreate2() { SpecialRepositoryADO repo = new SpecialRepositoryADO(); Special special = new Special() { Title = "Test Title" }; var returnSpecial = repo.Create(special); Assert.AreEqual(null, returnSpecial); }
public void CanCreateFailCreate1() { SpecialRepositoryADO repo = new SpecialRepositoryADO(); Special special = new Special() { Description = "Heres a Special" }; var returnSpecial = repo.Create(special); Assert.AreEqual(null, returnSpecial); }
public ActionResult Index() { HomeIndexVM VM = new HomeIndexVM(); var repo = new SpecialRepositoryADO(); VM.Specials = repo.ReadAllSpecials(); var vRepo = new VehicleRepositoryADO(); VM.Vehicles = vRepo.ReadAllVehicle(); return(View(VM)); }
public void CanCreateAndDeleteSpecial() { SpecialRepositoryADO repo = new SpecialRepositoryADO(); Special special = new Special() { Description = "Heres a Special", Title = "Test Title" }; var specialsBefore = repo.GetAll(); var returnSpecial = repo.Create(special); var specialsAfter = repo.GetAll(); Assert.AreEqual(specialsBefore.Count() + 1, specialsAfter.Count()); specialsBefore = repo.GetAll(); repo.Delete(returnSpecial.SpecialId); specialsAfter = repo.GetAll(); Assert.AreEqual(specialsBefore.Count() - 1, specialsAfter.Count()); }
public ActionResult Specials(AdminSpecialsCM form, int id) { if (ModelState.IsValid) { AdminSpecialsVM VM = new AdminSpecialsVM(); Specials special = new Specials(); var repo = new SpecialRepositoryADO(); special.Title = form.Title; special.Description = form.Description; repo.CreateSpecial(special); repo.DeleteSpecial(special); //return View(VM); return(RedirectToAction("Specials")); } else { AdminSpecialsVM VM = new AdminSpecialsVM(); var repo = new SpecialRepositoryADO(); VM.Form = form; return(View(VM)); } }