CalcPrice() public method

Calculates price by list of coordinates coordinatesHistory
public CalcPrice ( ) : decimal
return decimal
Beispiel #1
0
        public void TestPriceCounter2Tarif()
        {
            pc = new PriceCounter(coords, tarifes);

            coords[5].TarifId = 2;
            coords[6].TarifId = 2;
            coords[7].TarifId = 2;
            coords[8].TarifId = 2;

            var actualy = pc.CalcPrice();
            var expected = 2 * tarif1.OneMinuteCost + tarif1.StartPrice + tarif2.OneMinuteCost*2;
            Assert.AreEqual(expected, actualy);
        }
Beispiel #2
0
        public void TestPriceCounter2TarifwhithSlowDriving()
        {
            pc = new PriceCounter(coords, tarifes);

            coords[5].TarifId = 2;
            coords[6].TarifId = 2;
            coords[7].TarifId = 2;
            coords[8].TarifId = 2;

            coords[5].AddedTime = time.AddMinutes(10);
            coords[6].AddedTime = time.AddMinutes(20);
            coords[7].AddedTime = time.AddMinutes(30);
            coords[8].AddedTime = time.AddMinutes(40);

            var actualy = pc.CalcPrice();
            var expected = (2 * tarif1.OneMinuteCost + tarif1.StartPrice) + tarif2.WaitingCost * 8 + tarif2.WaitingCost * 30;
            Assert.AreEqual(expected, actualy);
        }
Beispiel #3
0
        public void TestPriceCounter1Tarif()
        {
            pc = new PriceCounter(coords, tarifes);
            var actualy = pc.CalcPrice();
            var expected = 4 * tarif1.OneMinuteCost + tarif1.StartPrice;

            Assert.AreEqual(expected, actualy);
        }