public void TestDeactivateMaintenanceWorkOrderValid() { //Arrange int validMaintenanceWorkOrderID = _maintenanceWorkOrders[0].MaintenanceWorkOrderID; bool activeStatus = _maintenanceWorkOrders[0].Complete; //Act _maintenanceWorkOrderManager.DeleteMaintenanceWorkOrder(validMaintenanceWorkOrderID, activeStatus); //Assert Assert.IsFalse(_maintenanceWorkOrderManager.RetrieveMaintenanceWorkOrder(validMaintenanceWorkOrderID).Complete); }
/// <summary> /// Author: MDalton Cleveland /// Created : 2/21/2019 /// Attempts to delete the MaintenanceWorkOrder in our system when the "delete" button is clicked /// </summary> private void btnDelete_Click(object sender, RoutedEventArgs e) { string message = ""; try { _maintenanceWorkOrderManager.DeleteMaintenanceWorkOrder(_maintenanceWorkOrder.MaintenanceWorkOrderID, _maintenanceWorkOrder.Complete); if (_maintenanceWorkOrder.Complete) { message = "This Maintenance Work Order was deactivated successfully"; } else { message = "This Maintenance Work Order was deleted successfully"; } } catch (Exception ex) { message = "There was an error deleting this Maintenance Work Order: " + ex.Message; } MessageBox.Show(message); Close(); }