public void WhenSelectedItemIsBookedAndCancelIsClicked_ThenRemnoveTheUserIdConnectionToTheSelectedSlot() { var user = userManager.GetUserForUserName("Dawood"); object overtime = db.Overtime.Where(o => o.OvertimeId == user.UserId).FirstOrDefault(); overtimeManager.SetUser_IDs_ForBookedOvertime(user, overtime); overtimeManager.RemoveUser_IDs_FromBookedOvertime(overtime); Assert.AreEqual(null, overtimeManager.SelectedOvertime.UserId); }
private void btnCancel_Click(object sender, RoutedEventArgs e) { if (ListBox.SelectedItem != null) { overtimeManager.RemoveUser_IDs_FromBookedOvertime(ListBox.SelectedItem); ListBox.ItemsSource = null; ListBox.ItemsSource = overtimeManager.PopulateBookedOvertime(_userEntered); } else { MessageBox.Show("Please select a slot to Cancel"); } }