Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 addworkinghours error #6

Closed
wants to merge 3 commits into from
Closed

5 addworkinghours error #6

wants to merge 3 commits into from

Conversation

paonath
Copy link
Owner

@paonath paonath commented Jan 19, 2023

Resolved:

			var wts1 = new WorkTimeSpan() { Start = new TimeSpan(08, 00, 0), End = new TimeSpan(12, 0, 0) };
			var wts2 = new WorkTimeSpan() { Start = new TimeSpan(13, 30, 0), End = new TimeSpan(17, 30, 0) };
			var wts  = new List<WorkTimeSpan>() { wts1, wts2 };

			var italiansHoliDays = new List<AHolyDay>() { new EasterMonday() };
			var week = new WeekDaySpan()
			{
				WorkDays = new Dictionary<DayOfWeek, WorkDaySpan>()
				{
					{ DayOfWeek.Monday, new WorkDaySpan() { TimeSpans    = wts } },
					{ DayOfWeek.Tuesday, new WorkDaySpan() { TimeSpans   = wts } },
					{ DayOfWeek.Wednesday, new WorkDaySpan() { TimeSpans = wts } },
					{ DayOfWeek.Thursday, new WorkDaySpan() { TimeSpans  = wts } },
					{ DayOfWeek.Friday, new WorkDaySpan() { TimeSpans    = wts } },
					{ DayOfWeek.Saturday, new WorkDaySpan() { TimeSpans  = wts } }
				}
			};
			var utility  = new WorkingDaysAndTimeUtility(week, italiansHoliDays);

			var dateTime = new DateTime(2023, 1, 18, 12, 30, 22);
			var result = utility.AddWorkingHours(dateTime, 1);

            Assert.Equal(new DateTime(2023,1,18,14,30,22), result);

@paonath paonath self-assigned this Jan 19, 2023
@paonath paonath linked an issue Jan 19, 2023 that may be closed by this pull request
@paonath paonath closed this Jan 19, 2023
@paonath paonath mentioned this pull request Jan 19, 2023
@paonath paonath deleted the 5-addworkinghours-error branch January 19, 2023 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AddWorkingHours error
1 participant