public void BabySittertimeCard_GivenEndTimeBeforeStartTime_ThrowsArgumentException(int startTimeHours, int startTimeMinutes, int endTimeHours, int endTimeMinutes)
        {
            TwentyFourHourTime startTime = new TwentyFourHourTime(startTimeHours, startTimeMinutes);
            TwentyFourHourTime endTime   = new TwentyFourHourTime(endTimeHours, endTimeMinutes);

            Assert.Throws <ArgumentException>(delegate { new BabysitterTimeCard(startTime, endTime); });
        }
        public void BabysitterTimeCard_GivenStartTimeAfterMidnight_ThrowsArguementOutOfRangeException(int startTimeHours, int startTimeMinutes, int endTimeHours, int endTimeMinutes)
        {
            TwentyFourHourTime startTime = new TwentyFourHourTime(startTimeHours, startTimeMinutes);
            TwentyFourHourTime endTime   = new TwentyFourHourTime(endTimeHours, endTimeMinutes);

            Assert.Throws <ArgumentOutOfRangeException>(delegate { new BabysitterTimeCard(startTime, endTime); });
        }
        private BabysitterTimeCard initializeTimeCard(int startTimeHours, int startTimeMinutes, int endTimeHours, int endTimeMinutes, int bedTimeHours, int bedTimeMinutes)
        {
            var startTime = new TwentyFourHourTime(startTimeHours, startTimeMinutes);
            var endTime   = new TwentyFourHourTime(endTimeHours, endTimeMinutes);
            var bedTime   = new TwentyFourHourTime(bedTimeHours, bedTimeMinutes);

            return(new BabysitterTimeCard(startTime, endTime, bedTime));
        }
        public void BabysitterTimeCard_GivenTwoValidTime_CalculatesTotalTime(int startTimeHours, int startTimeMinutes, int endTimeHours, int endTimeMinutes)
        {
            TwentyFourHourTime startTime = new TwentyFourHourTime(startTimeHours, startTimeMinutes);
            TwentyFourHourTime endTime   = new TwentyFourHourTime(endTimeHours, endTimeMinutes);

            BabysitterTimeCard timeCard = new BabysitterTimeCard(startTime, endTime);

            Assert.AreEqual((endTime.Hours - startTime.Hours) + (((double)endTime.Minutes - (double)startTime.Minutes) / 60), timeCard.CalculateTotalTime());
        }
예제 #5
0
        public void TwentyFourHourTime_GivenValidTime_MinutesInitializeProperly(int hours, int minutes)
        {
            TwentyFourHourTime testTime = new TwentyFourHourTime(hours, minutes);

            Assert.That(testTime.Minutes, Is.EqualTo(minutes));
        }