public string ListSubmissions(int[] submissionIds, int[] workflowIds, string inputFileName, string status, string retrieved, int limit = 1000) { SubmissionStatus?parsedStatus = null; bool? parsedRetrieved = null; if (string.IsNullOrWhiteSpace(inputFileName)) { inputFileName = null; } if (!string.IsNullOrEmpty(status)) { if (!Enum.TryParse(status, out SubmissionStatus statusValue)) { throw new ArgumentException("Wrong status value provided. Please provide one of the valid submission statuses."); } else { parsedStatus = statusValue; } } if (!string.IsNullOrEmpty(retrieved)) { if (!bool.TryParse(retrieved, out bool retrievedValue)) { throw new ArgumentException("Wrong retreived value provided. Please provide \"True\" or \"False\" as a value."); } else { parsedRetrieved = retrievedValue; } } var submissionFilter = new SubmissionFilter { InputFilename = inputFileName, Status = parsedStatus, Retrieved = parsedRetrieved }; try { var submissions = Task.Run(async() => await _submissionsClient.ListAsync(submissionIds, workflowIds, submissionFilter, limit)).GetAwaiter().GetResult(); return(JsonConvert.SerializeObject(submissions, new StringEnumConverter())); } catch (System.Exception ex) { //AA doesn't understand custom exception types and the only important thing is message, so method catches all exceptions and throw new generic one with the correct message. throw new System.Exception(ex.Message); } }
public async Task ListAsync_ShouldFetchSubmissions() { // Arrange var listData = await _dataHelper.Submissions().ListAnyAsync(); // Act var submissions = await _submissionsClient.ListAsync(new List <int> { listData.submissionId }, new List <int> { listData.workflowId }, null); var submission = submissions.First(); // Assert submissions.Should().HaveCountGreaterThan(0); submission.Id.Should().BeGreaterThan(0); submission.Status.Should().BeOfType <SubmissionStatus>(); }
public async Task <ISubmission> GetAny() => (await _submissions.ListAsync(null, null, null, 1)).Single();