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 #7

Merged
merged 3 commits into from
Jan 19, 2023
Merged

5 addworkinghours error #7

merged 3 commits into from
Jan 19, 2023

Conversation

paonath
Copy link
Owner

@paonath paonath commented Jan 19, 2023

Resolve issue #6

see test:

//code omitted
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 merged commit ccc252e into develop 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.

1 participant