示例#1
0
    public MotorCycle(int weight)

    {
        Fee = FeeCalc.DetermineFeeByWeight(weight) * FeeCalc.MotorCycleDiscount;

        Weight = weight;
    }
示例#2
0
        public void Rule3_DayTimeWeekday()
        {
            // Arrange

            var heavyVehicle = new Vehicle(1200);
            var timespan2    = new TimeSpan(0700);

            heavyVehicle.timeOfPassage = timespan2;
            heavyVehicle.dateOfPassage = new DateTime(2018, 05, 14);

            var lightVehicle = new Vehicle(999);
            var timespan3    = new TimeSpan(1600);

            lightVehicle.timeOfPassage = timespan3;
            lightVehicle.dateOfPassage = new DateTime(2018, 05, 15);
            //Act

            FeeCalc.DetermineNightFee(heavyVehicle);
            FeeCalc.DetermineNightFee(lightVehicle);



            //Assert

            Assert.AreEqual(FeeCalc.HeavyWeightVehicleFee, heavyVehicle.Fee);
            Assert.AreEqual(FeeCalc.LightWeightVehicleFee, lightVehicle.Fee);
        }
示例#3
0
    public PrivateCar(int weight)

    {
        Fee = FeeCalc.DetermineFeeByWeight(weight);

        Weight = weight;
    }
示例#4
0
        public void Rule3_Weekend()
        {
            // Regel 7 ställer till det för regel 3. Avgiften dubblas istället...

            // Arrange

            var heavyNightVehicle = new Vehicle(1200);
            var timespan          = new TimeSpan(2200);

            heavyNightVehicle.timeOfPassage = timespan;
            heavyNightVehicle.dateOfPassage = new DateTime(2018, 05, 19);

            var lightNightVehicle = new Vehicle(999);
            var timespan1         = new TimeSpan(1801);

            lightNightVehicle.timeOfPassage = timespan1;
            lightNightVehicle.dateOfPassage = new DateTime(2018, 05, 20);

            var weekday = lightNightVehicle.weekdayOfPassage;

            //Act

            FeeCalc.DetermineOvertimeFee(heavyNightVehicle);
            FeeCalc.DetermineOvertimeFee(lightNightVehicle);



            //Assert

            Assert.AreEqual(2000, heavyNightVehicle.Fee);
            Assert.AreEqual(1000, lightNightVehicle.Fee);
        }
示例#5
0
        public void Rule3_NightTimeWeekday()
        {
            // Arrange

            var heavyNightVehicle = new Vehicle(1200);
            var timespan          = new TimeSpan(2200);

            heavyNightVehicle.timeOfPassage = timespan;
            heavyNightVehicle.dateOfPassage = new DateTime(2018, 05, 16);

            var lightNightVehicle = new Vehicle(999);
            var timespan1         = new TimeSpan(1801);

            lightNightVehicle.timeOfPassage = timespan1;
            lightNightVehicle.dateOfPassage = new DateTime(2018, 05, 16);
            //Act

            FeeCalc.DetermineNightFee(heavyNightVehicle);
            FeeCalc.DetermineNightFee(lightNightVehicle);


            //Assert

            Assert.AreEqual(500, heavyNightVehicle.Fee);
            Assert.AreEqual(250, lightNightVehicle.Fee);
        }
示例#6
0
        public void Rule6()
        {
            // Arrange

            var heavyTestBike = new MotorCycle(1100);
            var timespane     = new TimeSpan(2200);

            heavyTestBike.timeOfPassage = timespane;
            heavyTestBike.dateOfPassage = new DateTime(2018, 05, 14);

            var lightTestBike = new MotorCycle(800);
            var timespane1    = new TimeSpan(2200);

            lightTestBike.timeOfPassage = timespane1;
            lightTestBike.dateOfPassage = new DateTime(2018, 05, 14);


            //Act

            FeeCalc.DetermineNightFee(heavyTestBike);
            FeeCalc.DetermineNightFee(lightTestBike);

            //Assert

            Assert.AreEqual(350, heavyTestBike.Fee);
            Assert.AreEqual(175, lightTestBike.Fee);
        }
示例#7
0
        public void Rule5()
        {
            // Arrange

            var testVehicle = new PrivateCar(1200);
            var timespan    = new TimeSpan(1600);

            testVehicle.timeOfPassage = timespan;
            testVehicle.dateOfPassage = new DateTime(2018, 05, 15);

            //Act

            FeeCalc.DetermineNightFee(testVehicle);

            //Assert

            Assert.AreEqual(1000, testVehicle.Fee);
        }
示例#8
0
        public void Rule4()
        {
            // Arrange

            var testVehicle = new Truck();
            var timespan    = new TimeSpan(2200);

            testVehicle.timeOfPassage = timespan;
            testVehicle.dateOfPassage = new DateTime(2018, 05, 14);

            //Act

            FeeCalc.DetermineNightFee(testVehicle);

            //Assert

            Assert.AreEqual(2000, testVehicle.Fee);
        }
示例#9
0
        public void Rule8()
        {
            // Arrange

            var enviromentFriendlyVehicle    = new Vehicle(1000);
            var nonEnviromentFriendlyVehicle = new Vehicle(1200);

            enviromentFriendlyVehicle.enviromentFriendly    = true;
            nonEnviromentFriendlyVehicle.enviromentFriendly = false;

            //Act

            FeeCalc.DetermineEnviromentFriendlyFee(enviromentFriendlyVehicle);
            FeeCalc.DetermineEnviromentFriendlyFee(nonEnviromentFriendlyVehicle);

            //Assert

            Assert.AreEqual(0, enviromentFriendlyVehicle.Fee);
            Assert.AreEqual(1000, nonEnviromentFriendlyVehicle.Fee);
        }
示例#10
0
 public Vehicle(int weight)
 {
     Fee    = FeeCalc.DetermineFeeByWeight(weight);
     Weight = weight;
 }