Exemple #1
0
        public void SetSubmitDateInUtc_OnWeekend_ThrowsException()
        {
            var timestamp = new DateTime(2018, 5, 27, 10, 33, 1);

            Assert.Throws <OutOfWorkingHoursException>(() => BugFixBuilder.BugFix()
                                                       .WithSubmitDateInUtc(timestamp)
                                                       .WithDedicatedTimeInHours(4)
                                                       .AddNoMoreTime()
                                                       .Build());
        }
Exemple #2
0
        public void SetDedicatedTime_TimeIsZero_ThrowsException()
        {
            var timestamp = new DateTime(2018, 5, 28, 16, 0, 0);

            Assert.Throws <ZeroTimeDedicatedException>(() => BugFixBuilder.BugFix()
                                                       .WithSubmitDateInUtc(timestamp)
                                                       .WithDedicatedTimeInHours(0)
                                                       .WithDedicatedTimeInDays(0)
                                                       .WithDedicatedTimeInWeeks(0)
                                                       .AddNoMoreTime()
                                                       .Build());
        }
Exemple #3
0
        public void CalculateDueDate_9AmSubmit1WeekDedicatedTime_NextWeekSameDay9Am()
        {
            var bugfix = BugFixBuilder.BugFix()
                         .WithSubmitDateInUtc(new DateTime(2018, 5, 28, 9, 0, 0))
                         .WithDedicatedTimeInWeeks(1)
                         .AddNoMoreTime()
                         .Build();

            var expected = new DateTime(2018, 6, 4, 9, 0, 0);
            var actual   = _dueDateCalculator.CalculateDueDate(bugfix);

            Assert.Equal(expected, actual);
        }
Exemple #4
0
        public void CaculateDueDate_9AmSubmit4HoursDedicatedTime_SameDay1Pm()
        {
            var bugfix = BugFixBuilder.BugFix()
                         .WithSubmitDateInUtc(new DateTime(2018, 5, 28, 9, 0, 0))
                         .WithDedicatedTimeInHours(4)
                         .AddNoMoreTime()
                         .Build();

            var expected = new DateTime(2018, 5, 28, 13, 0, 0);
            var actual   = _dueDateCalculator.CalculateDueDate(bugfix);

            Assert.Equal(expected, actual);
        }
Exemple #5
0
        public void CalculateDueDate_9AmSubmit2Weeks3DaysDedicatedTime_2WeeksAnd3DaysLater9Am()
        {
            var bugfix = BugFixBuilder.BugFix()
                         .WithSubmitDateInUtc(new DateTime(2018, 5, 28, 9, 0, 0))
                         .WithDedicatedTimeInWeeks(2)
                         .WithDedicatedTimeInDays(3)
                         .AddNoMoreTime()
                         .Build();

            var expected = new DateTime(2018, 6, 14, 9, 0, 0);
            var actual   = _dueDateCalculator.CalculateDueDate(bugfix);

            Assert.Equal(expected, actual);
        }
Exemple #6
0
        public void CalculateDueDate_8PmSubmit4HoursDedicatedTime_NextWorkingDay1Pm()
        {
            var bugfix = BugFixBuilder.BugFix()
                         .WithSubmitDateInLocalTimeWithTimeZone(new DateTime(2018, 5, 28, 16, 0, 0),
                                                                TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"))
                         .WithDedicatedTimeInHours(4)
                         .AddNoMoreTime()
                         .Build();

            var expected = new DateTime(2018, 5, 29, 13, 0, 0);
            var actual   = _dueDateCalculator.CalculateDueDate(bugfix);

            Assert.Equal(expected, actual);
        }
Exemple #7
0
        public void SetSubmitDateInUtc_DuringWorkingHours_OK()
        {
            var timestamp = new DateTime(2018, 5, 28, 10, 0, 0);

            var bugFix = BugFixBuilder.BugFix()
                         .WithSubmitDateInUtc(timestamp)
                         .WithDedicatedTimeInHours(4)
                         .AddNoMoreTime()
                         .Build();

            var expected = timestamp;
            var actual   = bugFix.GetSubmitDateInUtc();

            Assert.Equal(expected, actual);
        }
Exemple #8
0
        public void SetSubmitDateInLocalTimeWithTimeZone_DuringWorkingHours_OK()
        {
            var timestamp   = new DateTime(2018, 5, 28, 16, 0, 0);
            var easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");

            var bugFix = BugFixBuilder.BugFix()
                         .WithSubmitDateInLocalTimeWithTimeZone(timestamp, easternZone)
                         .WithDedicatedTimeInHours(4)
                         .AddNoMoreTime()
                         .Build();

            var expected = timestamp - easternZone.GetUtcOffset(timestamp);
            var actual   = bugFix.GetSubmitDateInUtc();

            Assert.Equal(expected, actual);
        }
Exemple #9
0
        public void CalculateDueDate_9AmAlaskanTimeSubmit2Weeks3Days4HoursDedicatedTime_2Weeks3DaysLater1Pm()
        {
            var bugfix = BugFixBuilder.BugFix()
                         .WithSubmitDateInLocalTimeWithTimeZone(new DateTime(2018, 5, 28, 16, 0, 0),
                                                                TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"))
                         .WithDedicatedTimeInWeeks(2)
                         .WithDedicatedTimeInDays(3)
                         .WithDedicatedTimeInHours(4)
                         .AddNoMoreTime()
                         .Build();

            var expected = new DateTime(2018, 6, 15, 13, 0, 0);
            var actual   = _dueDateCalculator.CalculateDueDate(bugfix);

            Assert.Equal(expected, actual);
        }
Exemple #10
0
        public void SetDedicatedTime_OneWeekTwoDaysThreeHours_59()
        {
            var timestamp = new DateTime(2018, 5, 28, 16, 0, 0);

            var bugFix = BugFixBuilder.BugFix()
                         .WithSubmitDateInUtc(timestamp)
                         .WithDedicatedTimeInHours(3)
                         .WithDedicatedTimeInDays(2)
                         .WithDedicatedTimeInWeeks(1)
                         .AddNoMoreTime()
                         .Build();

            int expected = 59;
            int actual   = bugFix.GetDedicatedTimeInHours();

            Assert.Equal(expected, actual);
        }