public void WhenSelectedOvertimeOverlaps_FalseIsReturned() { var user = userManager.GetUserForUserName("Dawood"); object overtime = db.Overtime.Where(o => o.OvertimeId == 3).FirstOrDefault(); bool overlaps = overtimeManager.CheckForOverlap(user, overtime); Assert.AreEqual(false, overlaps); }
private void btnBook_Click(object sender, RoutedEventArgs e) { if (ListBox.SelectedItem != null) { if (overtimeManager.CheckForOverlap(_userEntered, ListBox.SelectedItem) == true) { overtimeManager.SetUser_IDs_ForBookedOvertime(_userEntered, ListBox.SelectedItem); ListBox.ItemsSource = null; if (overtimeManager.SelectedOvertime.Day.Equals("Monday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForMonday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Tuesday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForTuesday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Wednesday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForWednesday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Thursday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForThursday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Friday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForFriday(); } } else { MessageBox.Show("The Overtime slot you have selected overlaps with 1 or more of the booked overtimes. Please cancel any overlapping overtimes if you want to book this slot."); } } else { MessageBox.Show("Please select a slot to book for overtime."); } }