public static OldPrescriptionCalculator SetCombinations(Prescription prescription)
        {
            var pc = new OldPrescriptionCalculator(prescription);
            var combi = new MultiplierCombination(
                prescription,
                () => prescription.Total, () => prescription.Frequency, () => prescription.Quantity
            );

            pc.AddCalculation(combi);
            return pc;
        }
Ejemplo n.º 2
0
        public void CalculatorCanRectifySimpleCalculation()
        {
            var prescription = CreateParacetamolRect(Prescription.NewPrescription());
            prescription.Frequency.Value = 2;
            prescription.Quantity.Value = 4;
            var pc = new OldPrescriptionCalculator(prescription);

            var combi = new MultiplierCombination(
                prescription,
                () => prescription.Total, () => prescription.Frequency, () => prescription.Quantity
            );

            pc.AddCalculation(combi);
            pc.Execute();
            pc.Finish();

            Assert.AreEqual(2, prescription.Frequency.Value, "wrong frequency value");
            Assert.AreEqual(8, prescription.Total.Value, "wrong total value");
            Assert.AreEqual(4, prescription.Quantity.Value, "woring quantity value");
        }
Ejemplo n.º 3
0
 public void AddCombiToCalculator(Prescription p, OldPrescriptionCalculator pc, params Expression<Func<UnitValue>>[] properties)
 {
     var combi = new MultiplierCombination(p,properties);
     pc.AddCalculation(combi);
 }