void TimeSpanIsConstructedCorrectlyWithDefaultCtor()
        {
            var timeSpan = new MutableTimeSpan();

            Assert.Equal(0, timeSpan.Hour);
            Assert.Equal(0, timeSpan.Minute);
        }
        void TimeSpanIsConstructedCorrectlyWithTwoParameters(int hour, int minute)
        {
            var timeSpan = new MutableTimeSpan(hour, minute);

            Assert.Equal(timeSpan.Hour, hour);
            Assert.Equal(timeSpan.Minute, minute);
        }
        public DailyWorkTimeWeekPlan()
        {
            _workTimePlan = new Dictionary<DayOfWeek, IMutableTimeSpan>();

            foreach(var workday in Enum.GetValues(typeof(DayOfWeek)).Cast<DayOfWeek>())
                _workTimePlan[workday] = new MutableTimeSpan(0, 0);
        }
        void TimeSpanCanBeCreatedBy0SubstractingFrom0TimeSpan()
        {
            var timeSpan1 = new MutableTimeSpan(0, 0);

            var newtimeSpan = _factory.CreateAsSubstractionOf(timeSpan1, timeSpan1);

            AssertEqualHourMinuteAndTimeSpan(0, 0, newtimeSpan);
        }
        void ConversionToHourlyDecimalIsDoneCorrectly()
        {
            var timeSpan = new MutableTimeSpan(1, 15);

            var asDecimal = timeSpan.ToHourlyDecimal();
            
            Assert.Equal(asDecimal, 1.25m);
        }
        void TimeSpanCanBeCreatedBy0PositiveSubstractingFrom0TimeSpanWithoutMinuteOverflow()
        {
            var timeSpan1 = new MutableTimeSpan(0, 0);
            var timeSpan2 = new MutableTimeSpan(0, 30);

            var newtimeSpan = _factory.CreateAsSubstractionOf(timeSpan2, timeSpan1);

            AssertEqualHourMinuteAndTimeSpan(0, -30, newtimeSpan);
        }
        void MinuteIsCappedAt60AndConvertedIntoHoursInstead()
        {
            var timeSpan = new MutableTimeSpan();

            timeSpan.Minute = 90;

            Assert.Equal(timeSpan.Hour, 1);
            Assert.Equal(timeSpan.Minute, 30);
        }
        void TimeSpanCanBeCreatedByPositiveSubstractingFromPositiveTimeSpan()
        {
            var timeSpan1 = new MutableTimeSpan(2, 20);
            var timeSpan2 = new MutableTimeSpan(1, 10);

            var newtimeSpan = _factory.CreateAsSubstractionOf(timeSpan2, timeSpan1);

            AssertEqualHourMinuteAndTimeSpan(1, 10, newtimeSpan);
        }
        void TimeSpanCanBeCreatedByPositiveSubstractingFromNegativeTimeSpanWithMinuteOverflow()
        {
            var timeSpan1 = new MutableTimeSpan(-1, 40);
            var timeSpan2 = new MutableTimeSpan(2, 30);

            var newtimeSpan = _factory.CreateAsSubstractionOf(timeSpan2, timeSpan1);

            AssertEqualHourMinuteAndTimeSpan(-4, 10, newtimeSpan);
        }
        void TimeSpanCanBeCreatedFromAddingTwoPositiveTimeSpansWithoutMinuteOverflow()
        {
            var timeSpan1 = new MutableTimeSpan(2, 10);
            var timeSpan2 = new MutableTimeSpan(3, 10);

            var newtimeSpan = _factory.CreateAsAdditionOf(timeSpan1, timeSpan2);

            AssertEqualHourMinuteAndTimeSpan(5, 20, newtimeSpan);
        }
        void TimeSpanCanBeCreatedFromAddingTwoNegativeTimeSpansWithoutMinuteOverflow()
        {
            var timeSpan1 = new MutableTimeSpan(-2, 20);
            var timeSpan2 = new MutableTimeSpan(-3, 30);

            var newtimeSpan = _factory.CreateAsAdditionOf(timeSpan1, timeSpan2);

            AssertEqualHourMinuteAndTimeSpan(-5, 50, newtimeSpan);
        }
        void TimeSpanCanBeCreatedFromAddingTwo0TimeSpans()
        {
            var timeSpan1 = new MutableTimeSpan(0, 0);
            var timeSpan2 = new MutableTimeSpan(0, 0);

            var newtimeSpan = _factory.CreateAsAdditionOf(timeSpan1, timeSpan2);

            AssertEqualHourMinuteAndTimeSpan(0, 0, newtimeSpan);
        }
        void TimeSpanCanBeCreatedFromAddingTwo0PositiveTimeSpansWithOverflow()
        {
            var timeSpan1 = new MutableTimeSpan(0, 30);
            var timeSpan2 = new MutableTimeSpan(0, 40);

            var newtimeSpan = _factory.CreateAsAdditionOf(timeSpan1, timeSpan2);

            AssertEqualHourMinuteAndTimeSpan(1, 10, newtimeSpan);
        }
        void TimeSpanCanBeCreatedFromAddingTwo0NegativeTimeSpanWithoutOverflow()
        {
            var timeSpan1 = new MutableTimeSpan(0, -10);
            var timeSpan2 = new MutableTimeSpan(0, -40);

            var newtimeSpan = _factory.CreateAsAdditionOf(timeSpan1, timeSpan2);

            AssertEqualHourMinuteAndTimeSpan(0, -50, newtimeSpan);
        }
        void TimeSpanCanBeCreatedFromAddingAPositiveAndANegativeTimeSpanWithoutMinuteOverflow()
        {
            var timeSpan1 = new MutableTimeSpan(2, 40);
            var timeSpan2 = new MutableTimeSpan(-3, 50);

            var newtimeSpan = _factory.CreateAsAdditionOf(timeSpan1, timeSpan2);

            AssertEqualHourMinuteAndTimeSpan(-1, 10, newtimeSpan);
        }