public void Should_BeFalse_If_IsNotOverlappedByTimeSlot(string timeSlotStartDateTime, string timeSlotEndDateTime) { var busySlot = new BusySlot(DateTime.Parse("11/24/2019 08:00:00"), DateTime.Parse("11/24/2019 09:00:00")); busySlot.IsOverlappedByTimeSlot(DateTime.Parse(timeSlotStartDateTime), DateTime.Parse(timeSlotEndDateTime)) .Should().BeFalse(); }
public bool TryExtractBusySlotForEmployeeWith(string id, out BusySlot?busySlot) { busySlot = null; const string dateTimeRegexGroup = @"(\d{1,2}\/\d{1,2}\/\d{4} \d{1,2}:\d{1,2}:\d{1,2} (PM|AM))"; var lineWithEmployeeMeeting = @"^" + id + ";" + dateTimeRegexGroup + ";" + dateTimeRegexGroup + @";\w+$"; var match = Regex.Match(_line, lineWithEmployeeMeeting); if (match.Groups.Count != 5) { return(false); } if (!DateTime.TryParse(match.Groups[1].Value, out var busySlotStartTime)) { return(false); } if (!DateTime.TryParse(match.Groups[3].Value, out var busySlotEndTime)) { return(false); } busySlot = new BusySlot(busySlotStartTime.ToLocalTime(), busySlotEndTime.ToLocalTime()); return(true); }