public void A010_SaveNewTest()
        {
            carsRepository.SaveAndFlush(Car1);

            Car carCheck = carsRepository.GetById(Car1.PrimaryKey);

            Assert.IsNotNull(carCheck);
            Assert.AreEqual(Car1.PrimaryKey, carCheck.PrimaryKey);
            Assert.AreEqual(Car1.Name, carCheck.Name);
            Assert.AreEqual(Car1.ManufacturerKey, carCheck.ManufacturerKey);
            Assert.AreEqual(Car1.Year, carCheck.Year);
            Assert.AreEqual(Car1.Category, carCheck.Category);
            Assert.AreEqual(Car1.Price, carCheck.Price);
            Assert.AreEqual(Car1.DisplacementCC, carCheck.DisplacementCC);
            Assert.AreEqual(Car1.MaxPower, carCheck.MaxPower);
            Assert.AreEqual(Car1.PowerRPM, carCheck.PowerRPM);
            Assert.AreEqual(Car1.TorqueFTLB, carCheck.TorqueFTLB);
            Assert.AreEqual(Car1.TorqueRPM, carCheck.TorqueRPM);
            Assert.AreEqual(Car1.DriveTrain, carCheck.DriveTrain);
            Assert.AreEqual(Car1.Aspiration, carCheck.Aspiration);
            Assert.AreEqual(Car1.Length, carCheck.Length);
            Assert.AreEqual(Car1.Width, carCheck.Width);
            Assert.AreEqual(Car1.Height, carCheck.Height);
            Assert.AreEqual(Car1.Weight, carCheck.Weight);
            Assert.AreEqual(Car1.MaxSpeed, carCheck.MaxSpeed);
            Assert.AreEqual(Car1.Acceleration, carCheck.Acceleration);
            Assert.AreEqual(Car1.Braking, carCheck.Braking);
            Assert.AreEqual(Car1.Cornering, carCheck.Cornering);
            Assert.AreEqual(Car1.Stability, carCheck.Stability);
        }
Esempio n. 2
0
        public static void TestFixtureSetup(TestContext context)
        {
            con = new NpgsqlConnection(cs);
            con.Open();

            regionsRepository       = new RegionsRepository(con);
            countriesRepository     = new CountriesRepository(con);
            manufacturersRepository = new ManufacturersRepository(con);
            manufacturerValidation  = new ManufacturerValidation(con);
            carsRepository          = new CarsRepository(con);

            regionsRepository.Save(Region1);
            regionsRepository.Save(Region2);
            regionsRepository.Save(Region3);
            regionsRepository.Flush();

            countriesRepository.Save(Country1);
            countriesRepository.Save(Country2);
            countriesRepository.Save(Country3);
            countriesRepository.Flush();

            manufacturersRepository.Save(Manufacturer1);
            manufacturersRepository.Save(Manufacturer2);
            manufacturersRepository.Save(Manufacturer3);
            manufacturersRepository.Flush();

            carsRepository.SaveAndFlush(Car2);
        }