public PlacesController() { // try this.context = new PlaceDbB2(); this.imageContex = new PlaceDbB2(); this.repo = new EFRepo<Place>(this.context); this.imageRepo = new EFRepo<ImageUrl>(this.imageContex); }
public void CanGetAllNewCarsEF() { IVehicleRepository repo = new EFRepo(); var search = repo.Search(new VehicleSearchParameters { MinPrice = 0, MaxPrice = 100000, IsNew = true }); Assert.AreEqual(8, search.Count); }
public void CanLoadCarsEF() { IVehicleRepository repo = new EFRepo(); var vehicle = repo.GetAll(); Assert.AreEqual(9, vehicle.Count); Assert.AreEqual("Silver", vehicle[0].Color); Assert.AreEqual("White", vehicle[0].Interior); Assert.AreEqual("Manual", vehicle[0].Transmission); Assert.AreEqual("1XP7DU9X48D704313", vehicle[0].VinNumber); }
public void CanLoadSingleDvdWithEF() { IDvdRepository repo = new EFRepo(); var dvd = repo.GetOne(6); Assert.AreEqual(6, dvd.DvdId); Assert.AreEqual("Suburbicon", dvd.Title); Assert.AreEqual(2017, dvd.ReleaseYear); Assert.AreEqual("PG-13", dvd.Rating); Assert.AreEqual("Matt Damon", dvd.DirectorName); }
public void CanLoadDvdsWithEF() { IDvdRepository repo = new EFRepo(); var dvd = repo.GetAll(); Assert.AreEqual(8, dvd.Count); Assert.AreEqual(2, dvd[0].DvdId); Assert.AreEqual("FaceOff", dvd[0].Title); Assert.AreEqual(1997, dvd[0].ReleaseYear); }
public void CanSearchVehicleEF() { IVehicleRepository repo = new EFRepo(); var search = repo.Search(new VehicleSearchParameters { SearchKey = "Chevy" }); search = repo.Search(new VehicleSearchParameters { SearchKey = "Camero" }); Assert.AreEqual(1, search.Count); }
public void CanDeleteDvdWithEF() { IDvdRepository repo = new EFRepo(); Dvd dvdToDelete = new Dvd(); repo.Delete(9); repo.GetOne(9); Assert.AreNotEqual("Spider-Women: Going Away", dvdToDelete.Title); Assert.AreNotEqual(2019, dvdToDelete.ReleaseYear); Assert.AreNotEqual("PG", dvdToDelete.Rating); }
public void CanAddMake() { Make MakeToAdd = new Make(); IVehicleRepository repo = new EFRepo(); MakeToAdd.Date = DateTime.Now; MakeToAdd.MakeName = "VW"; repo.AddMake(MakeToAdd); var addMake = repo.GetMakeById(MakeToAdd.MakeId); Assert.AreEqual(MakeToAdd.MakeId, addMake.MakeId); }
public void CanAddUser() { Users userToAdd = new Users(); IVehicleRepository repo = new EFRepo(); userToAdd.Id = "1aa288eb-815c-4d3e-b018-f39c280b630j"; userToAdd.FirstName = "Jordan"; userToAdd.LastName = "Watts"; userToAdd.Email = "*****@*****.**"; repo.AddUser(userToAdd); var addTest = repo.GetUserById(userToAdd.Id); Assert.AreEqual(userToAdd.Id, addTest.Id); }
public void CanAddDvdWithEF() { IDvdRepository repo = new EFRepo(); Dvd dvdToAdd = new Dvd(); dvdToAdd.DvdId = 8; dvdToAdd.Title = "Spider-Man: Homecoming"; dvdToAdd.ReleaseYear = 2017; dvdToAdd.Rating = "PG-13"; dvdToAdd.DirectorName = "Jon Watts"; repo.Add(dvdToAdd); var addedDvd = repo.GetOne(dvdToAdd.DvdId); Assert.AreEqual("Spider-Man: Homecoming", addedDvd.Title); Assert.AreNotEqual("R", addedDvd.Rating); }
public ActionResult Index() { EFRepo repo = new EFRepo(); return(View(repo.GetIZDs())); }
public EFController(PShopContext db) { _repo = new EFRepo(db); }