Exemplo n.º 1
0
        public void TestSimpleCalculMassGeneric()
        {
            CalculPrestation<Mass, MassCurrency> cpm = new CalculPrestation<Mass, MassCurrency>();
            ICalculTranche<Mass, MassCurrency> ict = new CalculTranche<Mass, MassCurrency>();
            ict.Add(11.4 * Mass.Kilogram, MassCurrency.EuroKilogramme * 55, true);
            ict.Add(25 * Mass.Kilogram, MassCurrency.EuroKilogramme * 4.83);
            ict.Add(50 * Mass.Kilogram, MassCurrency.EuroKilogramme * 3.87);
            ict.Add(100 * Mass.Kilogram, MassCurrency.EuroKilogramme * 3.38);
            ict.Add(200 * Mass.Kilogram, MassCurrency.EuroKilogramme * 3.14);
            ict.Add(9999 * Mass.Kilogram, MassCurrency.EuroKilogramme * 1.05);

            var result = cpm.Calculate(Mass.Kilogram * 10, ict);
            Assert.AreEqual(result, 55 * Currency.Euro);

            result = cpm.Calculate(Mass.Kilogram * 27, ict);
            Assert.AreEqual(result, 3.87 * 27 * Currency.Euro);

            result = cpm.Calculate(Mass.Kilogram * 250, ict);
            Assert.AreEqual(result, 1.05 * 250 * Currency.Euro);
        }
Exemplo n.º 2
0
        public void TestSimpleCalculAreaGeneric()
        {
            CalculPrestation<Area, AreaCurrency> cpm = new CalculPrestation<Area, AreaCurrency>();
            ICalculTranche<Area, AreaCurrency> ict = new CalculTranche<Area, AreaCurrency>();
            ict.Add(AreaCurrency.EuroSquareMetre * 15, Currency.Euro * 80);


            var result = cpm.Calculate(Area.SquareMetre * 10, ict);
            Assert.AreEqual(result, 150 * Currency.Euro);

            result = cpm.Calculate(Area.SquareMetre * 1.5, ict);
            Assert.AreEqual(result, 80 * Currency.Euro);
        }