public void TimeOfDayClass_AddMethodWithTimeSpanAndTimeOfDayParameters_ThrowsArgumentNullExceptionIfSecondParameterIsNull()
        {
            int       testSeconds0 = _rnd.Next(86398);
            TimeSpan  testValue0   = TimeSpan.FromSeconds(testSeconds0);
            TimeOfDay testValue1   = null;

            _ = TimeOfDay.Add(testValue0, testValue1);

            Assert.Fail();
        }
        public void TimeOfDayClass_AddMethodWithTimeSpanAndTimeOfDayParameters_ReturnsTimeOfDayWithCorrectValueIfResultDoesNotCrossMidnight()
        {
            int       testSeconds0 = _rnd.Next(86398);
            int       testSeconds1 = _rnd.Next(86399 - testSeconds0) + testSeconds0;
            TimeSpan  testValue0   = TimeSpan.FromSeconds(testSeconds0);
            TimeOfDay testValue1   = new TimeOfDay(testSeconds1);

            TimeOfDay testOutput = TimeOfDay.Add(testValue0, testValue1);

            Assert.AreEqual(testSeconds0 + testSeconds1, testOutput.AbsoluteSeconds);
        }
Exemplo n.º 3
0
        public ScheduleUI(IScheduleDataService scheduleDataService,
                          IAppointmentDataService appointmentDataService)
        {
            _scheduleDataService    = scheduleDataService;
            _appointmentDataService = appointmentDataService;

            int currYear = DateTime.Now.Year;

            Years.Add(currYear.ToString());
            Years.Add((currYear + 1).ToString());

            TimeOfDay.Add("Morning");
            TimeOfDay.Add("Noon");
            TimeOfDay.Add("Afternoon");
            TimeOfDay.Add("No Preference");
        }
        public void TimeOfDayClass_AddMethodWithTimeSpanAndTimeOfDayParameters_ThrowsArgumentNullExceptionWithCorrectParamNamePropertyIfSecondParameterIsNull()
        {
            int       testSeconds0 = _rnd.Next(86398);
            TimeSpan  testValue0   = TimeSpan.FromSeconds(testSeconds0);
            TimeOfDay testValue1   = null;

            try
            {
                _ = TimeOfDay.Add(testValue0, testValue1);
                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("t2", ex.ParamName);
            }
        }