示例#1
0
 protected override int Convert(MedicineWithDoses value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     if (value == null)
     {
         return(99);
     }
     return(CountdownHelper.CalcCountDownValue(value));
 }
示例#2
0
        public void Test_CalcCountDownForMedNoTimes_Is99()
        {
            var time = new DateTime(2016, 2, 25, 8, 0, 0);

            var medWithDoses = new MedicineWithDoses(new Medicine(), () => time);
            var count        = CountdownHelper.CalcCountDownValue(medWithDoses, () => time);

            Assert.AreEqual(99, count);
        }
示例#3
0
        public void Test_CalcCountDownForMed_Pref_LunchDinner_AfterDinner_IsCorrect()
        {
            var time = new DateTime(2016, 2, 25, 22, 0, 0);

            var medWithDoses = new MedicineWithDoses(new Medicine(), () => time);

            medWithDoses.AddDoseTimes(new[] { TimeOfDay.Lunch, TimeOfDay.Dinner });
            var count = CountdownHelper.CalcCountDownValue(medWithDoses, () => time);

            Assert.AreEqual(94, count);
        }
示例#4
0
        public void Test_CalcCountDownForMed_Pref_Lunch_IsCorrect()
        {
            var time = new DateTime(2016, 2, 25, 8, 0, 0);

            var medWithDoses = new MedicineWithDoses(new Medicine(), () => time);

            medWithDoses.AddDoseTime(TimeOfDay.Lunch);
            var count = CountdownHelper.CalcCountDownValue(medWithDoses, () => time);

            Assert.AreEqual(25, count);
        }
示例#5
0
        public void Test_CalcCountDownForNullMed()
        {
            var count = CountdownHelper.CalcCountDownValue(null);

            Assert.AreEqual(0, count);
        }