Пример #1
0
 public void CalculatorCanCalculatePrescriptionQuantity()
 {
     var prescription = CreateParacetamolRect(Prescription.NewPrescription());
     prescription.Frequency.Value = 2;
     prescription.Total.Value = 8;
     var pc = new OldPrescriptionCalculator(prescription);
     AddCombiToCalculator(prescription, pc, () => prescription.Total, () => prescription.Frequency, () => prescription.Quantity);
     pc.Execute();
     pc.Finish();
     Assert.AreEqual(4, prescription.Quantity.Value, "wrong admin quantity value");
 }
Пример #2
0
 public void CalculatorCanCalculateDoseTotal()
 {
     var prescription = CreateParacetamolRect(Prescription.NewPrescription());
     prescription.Frequency.Value = 2;
     prescription.Doses[0].Quantity.Value = 480;
     var pc = new OldPrescriptionCalculator(prescription);
     AddCombiToCalculator(prescription, pc, () => prescription.Doses[0].Total, () => prescription.Frequency, () => prescription.Doses[0].Quantity);
     pc.Execute();
     pc.Finish();
     Assert.AreEqual(960, prescription.Doses[0].Total.Value, "wrong dose total value");
 }
Пример #3
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");
        }