public void Two_Instances_Overlap_If_Start_Between(int start1, int end1, int start2, int end2) { var vacation1 = new Vacation(DateTime.UtcNow.AddDays(start1), DateTime.UtcNow.AddDays(end1)); var vacation2 = new Vacation(DateTime.UtcNow.AddDays(start2), DateTime.UtcNow.AddDays(end2)); vacation1.Overlaps(vacation2).Should().BeTrue(); vacation2.Overlaps(vacation1).Should().BeTrue(); }
private void Add_Click(object sender, RoutedEventArgs e) { if (Start == null || End == null) { return; } if (GetNumberOfBusinessDays(Start, End) > Doctor.DaysOfVacation || GetNumberOfBusinessDays(Start, End) <= 0) { return; } Vacation newVacation = new Vacation(Start, End); if (newVacation.Overlaps(Vacations)) { return; } _doctorController.AddVacation(Doctor, newVacation); UpdateValues(); }