public void FoodDosageCarbsHigherThanRatioTest() { //Arrange var dosageVariables = new DosageVariables() { insulinToCarbRatio = 30, bloodSugar = 150, correctionFactor = 180, targetBloodSugar = 150, carbs = 40 }; var calc = new DosageCalulcator(dosageVariables); //Act var dosage = calc.Calculate(); //Assert Assert.AreEqual((double)40 / 30, dosage); }
public void BloodGluscoseDosageCalcHigherThanTarget() { //Arrange var dosageVariables = new DosageVariables() { insulinToCarbRatio = 30, bloodSugar = 180, correctionFactor = 180, targetBloodSugar = 150, carbs = 0 }; var calc = new DosageCalulcator(dosageVariables); var expected = (dosageVariables.bloodSugar - dosageVariables.targetBloodSugar) / dosageVariables.correctionFactor; //Act var dosage = calc.Calculate(); //Assert Assert.AreEqual(expected, dosage); }
public void RoundingDownTestWithWholeUnit() { //Arrange var carbs = 1.15 * 50; var dosageVariables = new DosageVariables() { insulinToCarbRatio = 50, bloodSugar = 90, correctionFactor = 180, targetBloodSugar = 150, carbs = carbs }; var calc = new DosageCalulcator(dosageVariables); var expected = (double)1.0; //Act var dosage = calc.Calculate().Round(0.5); //Assert Assert.AreEqual(expected, dosage); }