Пример #1
0
        public void CanLoadListingById()
        {
            var repo = new VehicleListingRepository();

            var vehicle = repo.GetById(2);

            Assert.AreEqual(2, vehicle.VehicleMakeId);
            Assert.AreEqual(2, vehicle.VehicleModelId);
            Assert.AreEqual(1, vehicle.VehicleTypeId);
            Assert.AreEqual(19000M, vehicle.MSRP);
            Assert.AreEqual(16500M, vehicle.SalePrice);
            Assert.AreEqual("test car 2", vehicle.Description);
        }
Пример #2
0
        public void CanDeleteVehicleListing()
        {
            var repo = new VehicleListingRepository();

            VehicleListing test = new VehicleListing()
            {
                VehicleMakeId      = 1,
                VehicleModelId     = 1,
                VehicleTypeId      = 2,
                BodyStyleId        = 3,
                TransmissionTypeId = 2,
                Year            = 2020,
                ColorId         = 3,
                InteriorColorId = 1,
                Mileage         = 0,
                VIN             = "test",
                MSRP            = 99000M,
                SalePrice       = 92000M,
                Description     = "New Car",
                FeaturedVehicle = true,
                ImageFileName   = "test.png",
                Sold            = false
            };

            repo.Insert(test);


            var vehicle = repo.GetById(9);

            Assert.IsNotNull(vehicle);

            repo.Delete(9);

            vehicle = repo.GetById(9);

            Assert.IsNull(vehicle);
        }
Пример #3
0
        public void CanInsertVehicleListing()
        {
            var repo = new VehicleListingRepository();

            VehicleListing test = new VehicleListing()
            {
                VehicleMakeId      = 1,
                VehicleModelId     = 1,
                VehicleTypeId      = 2,
                BodyStyleId        = 3,
                TransmissionTypeId = 2,
                Year            = 2020,
                ColorId         = 3,
                InteriorColorId = 1,
                Mileage         = 0,
                VIN             = "test",
                MSRP            = 99000M,
                SalePrice       = 92000M,
                Description     = "New Car",
                FeaturedVehicle = true,
                ImageFileName   = "test.png",
                Sold            = false
            };

            repo.Insert(test);


            var vehicle = repo.GetById(9);


            Assert.AreEqual(1, vehicle.VehicleMakeId);
            Assert.AreEqual(1, vehicle.VehicleModelId);
            Assert.AreEqual(2, vehicle.VehicleTypeId);
            Assert.AreEqual(3, vehicle.BodyStyleId);
            Assert.AreEqual(2, vehicle.TransmissionTypeId);
            Assert.AreEqual(2020, vehicle.Year);
            Assert.AreEqual(3, vehicle.ColorId);
            Assert.AreEqual(1, vehicle.InteriorColorId);
            Assert.AreEqual(0, vehicle.Mileage);
            Assert.AreEqual("test", vehicle.VIN);
            Assert.AreEqual(99000M, vehicle.MSRP);
            Assert.AreEqual(92000M, vehicle.SalePrice);
            Assert.AreEqual("New Car", vehicle.Description);
            Assert.AreEqual(true, vehicle.FeaturedVehicle);
            Assert.AreEqual("test.png", vehicle.ImageFileName);
            Assert.AreEqual(false, vehicle.Sold);
        }