public void Returns_OK() { outage.Id = id; outage.Description = "Update"; Response <bool> response = system.Update(outage); bool result = response.Data; ResponseStatus status = response.Status; Assert.IsTrue(result); Assert.AreEqual(ResponseStatus.OK, status); }
public void Return_ERROR_because_of_validation(string description, string creationDate, string elementName, double latitude, double longitude, string actionDescription, string actionExecutionDate) { Outage outage = new Outage(); outage.Id = 1; outage.Description = description; outage.CreationDate = DateTime.Parse(creationDate); outage.ElementName = elementName; outage.Latitude = latitude; outage.Longitude = longitude; ExecutedAction action = new ExecutedAction(); action.Description = actionDescription; action.ExecutionDate = DateTime.Parse(actionExecutionDate); outage.Actions.Add(action); Response <bool> response = invalidSystem.Update(outage); bool result = response.Data; ResponseStatus status = response.Status; Assert.IsFalse(result); Assert.AreEqual(ResponseStatus.Error, status); }
private void UpdateOutage() { try { Response <bool> response = oms.Update(Outage); if (response.Status == ResponseStatus.OK) { Close(); } else { MessageBox.Show($"Error: {response.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Close(); } } catch (Exception ex) { MessageBox.Show($"Server error: {ex.Message}", "Server error", MessageBoxButton.OK, MessageBoxImage.Error); oms = Connection.GenerateChannel(); } }