コード例 #1
0
        public void TestAddTime()
        {
            PartsLaborRepair repair = new PartsLaborRepair("123", DateTime.Now);

            repair.AddMinutes(30);
            Assert.AreEqual(30, repair.Minutes);
            repair.AddHours(0.75);
            Assert.AreEqual(75, repair.Minutes);
            repair.AddHours(-1.3);
            Assert.AreEqual(75, repair.Minutes);
            repair.AddMinutes(-10);
            Assert.AreEqual(75, repair.Minutes);
        }
コード例 #2
0
        public void SetUp()
        {
            ford    = new Car("Ford", "Escape", 2014);
            toyota  = new Car("Toyota", "Prius", 2010);
            coolCar = new Car("Tesla", "Model S", 2014);

            jan1_14 = new DateTime(2014, 1, 1);
            feb4_14 = new DateTime(2014, 2, 4);
            mar3_14 = new DateTime(2014, 3, 3);
            feb20   = new DateTime(2014, 2, 20);

            toyota.AddRepair("1011", jan1_14, "Oil change", 20);
            toyota.AddRepair("1012", feb4_14, "balance wheels", 50);

            ListRepair       oilChange    = new ListRepair("123", feb20, "Oil Change", 30.00);
            ListRepair       tireRotation = new ListRepair("124", jan1_14, "Tire Rotation", 15.0);
            Part             fender       = new Part("Fender", 125);
            PartsLaborRepair plRepair     = new PartsLaborRepair("125", mar3_14);

            plRepair.AddPart(fender);
            plRepair.AddHours(2.0);
            coolCar.AddRepair(oilChange);
            coolCar.AddRepair(tireRotation);
            coolCar.AddRepair(plRepair);
        }
コード例 #3
0
        public void TestAmount()
        {
            PartsLaborRepair repair = new PartsLaborRepair("123", DateTime.Now);
            Part             fender = new Part("Fender", 200.00f);
            Part             tire   = new Part("Tire", 100.10f);

            repair.AddPart(fender);
            repair.AddPart(tire);
            repair.AddMinutes(30);
            repair.AddHours(0.5);
            Assert.AreEqual(200 + 100.1 + 75, repair.Amount, 0.001);
        }