public async Task Close(int closedBy, string description, string version) { var cmd = new CloseIncident(description, DTO.Id) { UserId = closedBy, ApplicationVersion = version }; await _apiClient.SendAsync(cmd); async Task <bool> Func() { var query = new GetIncident(DTO.Id); var result = await _apiClient.QueryAsync(query); if (result.Solution != description) { return(false); } DTO = result; return(true); } if (!await ActionExtensions.Retry(Func)) { throw new TestFailedException($"Incident {DTO.Id} was not closed."); } }
public async Task Update(Func <GetIncidentResult, bool> filter = null) { if (filter == null) { filter = x => x.UpdatedAtUtc != DTO.UpdatedAtUtc; } async Task <bool> Func() { var query = new GetIncident(DTO.Id); var result = await _apiClient.QueryAsync(query); if (!filter(result)) { return(false); } DTO = result; return(true); } if (!await ActionExtensions.Retry(Func)) { throw new TestFailedException($"Incident {DTO.Id} was not updated."); } }
public async Task ReOpen(string version) { _reporter.ReportCopy(_report, Guid.NewGuid().ToString(), x => { var col = x.ContextCollections.GetCoderrCollection(); col.Properties["AppAssemblyVersion"] = version; }); async Task <bool> Func() { var query = new GetIncident(DTO.Id); var result = await _apiClient.QueryAsync(query); if (!result.IsReOpened) { return(false); } DTO = result; return(true); } if (!await ActionExtensions.Retry(Func)) { throw new TestFailedException($"Incident {DTO.Id} was not reopened."); } }
public static async Task <GetIncidentResult> GetIncident(this ServerApiClient client, int applicationId, string incidentMessage, string reportMessage = null) { var id = await client.GetIncidentId(applicationId, incidentMessage, reportMessage); if (id == null) { throw new InvalidOperationException("Failed to find our uploaded report"); } var query = new GetIncident(id.Value); var result = await client.QueryAsync(query); if (result != null) { Console.WriteLine($"Got incident {result.CreatedAtUtc:yyyyMMdd hh:mm:ss.fff}"); } return(result); }
public async Task Assign(int userId) { await _apiClient.SendAsync(new AssignIncident(DTO.Id, userId, userId)); async Task <bool> Func() { var query = new GetIncident(DTO.Id); var result = await _apiClient.QueryAsync(query); if (result.AssignedToId != userId) { return(false); } DTO = result; return(true); } if (!await ActionExtensions.Retry(Func)) { throw new TestFailedException($"Incident {DTO.Id} was not assigned to {userId}."); } }