public void CanGetAllCars() { CarsRepositoryMock repo = new CarsRepositoryMock(); List <Car> cars = repo.GetAllCars().ToList(); Assert.AreEqual(10, cars.Count); Assert.AreEqual("2ABC2ABC2ABC2ABC2", cars[1].VIN); Assert.AreEqual(2, cars[1].CarId); Assert.AreEqual(new DateTime(2018, 1, 1), cars[1].ModelYear); Assert.IsTrue(cars[1].IsNew); Assert.IsFalse(cars[1].IsSold); Assert.IsTrue(cars[1].IsFeatured); Assert.AreEqual(5, cars[1].UnitsInStock); Assert.AreEqual("200", cars[1].Mileage); Assert.AreEqual(2, cars[1].BodyColorId); Assert.AreEqual(2, cars[1].BodyStyleId); Assert.AreEqual(2, cars[1].TransmissionId); Assert.AreEqual(2, cars[1].MakeId); Assert.AreEqual(3, cars[1].ModelId); Assert.AreEqual(3, cars[1].InteriorColorId); Assert.AreEqual(33000.00m, cars[1].SalePrice); Assert.AreEqual(34150.00m, cars[1].MSRP); Assert.AreEqual("/Images/2018AcuraTLX.png", cars[1].IMGFilePath); Assert.AreEqual("A silver bullet of power and dependability.", cars[1].VehicleDetails); }
public void CanAddCar() { Car car = new Car { ModelYear = new DateTime(2015, 1, 1), IsNew = false, IsFeatured = true, IsSold = false, UnitsInStock = 1, Mileage = "20000", VIN = "5ABC5ABC5ABC5ABC5", BodyColorId = 5, BodyStyleId = 3, TransmissionId = 2, MakeId = 3, ModelId = 2, InteriorColorId = 5, SalePrice = 19500m, MSRP = 21000m, IMGFilePath = "Images/placeholder.png", VehicleDetails = "2015 Ford Escape. Fully Loaded!" }; CarsRepositoryMock repo = new CarsRepositoryMock(); repo.Insert(car); List <Car> cars = repo.GetAllCars().ToList(); Assert.AreEqual(11, cars.Count); Assert.AreEqual(5, cars[4].CarId); Assert.AreEqual(car.ModelYear, cars[10].ModelYear); Assert.AreEqual(car.IsNew, cars[10].IsNew); Assert.AreEqual(car.IsFeatured, cars[10].IsFeatured); Assert.AreEqual(car.IsSold, cars[10].IsSold); Assert.AreEqual(car.UnitsInStock, cars[10].UnitsInStock); Assert.AreEqual(car.Mileage, cars[10].Mileage); Assert.AreEqual(car.VIN, cars[10].VIN); Assert.AreEqual(car.BodyColorId, cars[10].BodyColorId); Assert.AreEqual(car.BodyStyleId, cars[10].BodyStyleId); Assert.AreEqual(car.TransmissionId, cars[10].TransmissionId); Assert.AreEqual(car.MakeId, cars[10].MakeId); Assert.AreEqual(car.ModelId, cars[10].ModelId); Assert.AreEqual(car.InteriorColorId, cars[10].InteriorColorId); Assert.AreEqual(car.SalePrice, cars[10].SalePrice); Assert.AreEqual(car.MSRP, cars[10].MSRP); Assert.AreEqual(car.IMGFilePath, cars[10].IMGFilePath); Assert.AreEqual(car.VehicleDetails, cars[10].VehicleDetails); }