diff --git a/IndicoV2.IntegrationTests/Extensions/DataSets/DataSetsAwaiterTests.cs b/IndicoV2.IntegrationTests/Extensions/DataSets/DataSetsAwaiterTests.cs index 2df34da2..4eef4af3 100644 --- a/IndicoV2.IntegrationTests/Extensions/DataSets/DataSetsAwaiterTests.cs +++ b/IndicoV2.IntegrationTests/Extensions/DataSets/DataSetsAwaiterTests.cs @@ -51,22 +51,22 @@ public async Task WaitAllFilesDownloadedOrFailedAsync_ShouldWaitUntilFilesDownlo public async Task WaitFilesProcessedOrFailedAsync_ShouldWaitUntilAllFilesProcessedOrFailed() { // Arrange - var datasSet = await _dataHelper.DataSets().GetAny(); + var dataSet = await _dataHelper.DataSets().GetAny(); var filePaths = new[] {_dataHelper.Files().GetSampleFilePath()}; - await _dataSetsClient.AddFilesAsync(datasSet.Id, filePaths, default); - await _dataSetAwaiter.WaitFilesDownloadedOrFailedAsync(datasSet.Id, TimeSpan.Zero, default); + await _dataSetsClient.AddFilesAsync(dataSet.Id, filePaths, default); + await _dataSetAwaiter.WaitFilesDownloadedOrFailedAsync(dataSet.Id, TimeSpan.Zero, default); - var dataSetFileStatus = await _dataSetsClient.FileUploadStatusAsync(datasSet.Id, default); + var dataSetFileStatus = await _dataSetsClient.FileUploadStatusAsync(dataSet.Id, default); var downloadedFileIds = dataSetFileStatus.Dataset.Files.Where(f => f.Status == FileStatus.Downloaded).Select(f => f.Id.Value); - await _dataSetsClient.ProcessFileAsync(datasSet.Id, downloadedFileIds, default); + await _dataSetsClient.ProcessFileAsync(dataSet.Id, downloadedFileIds, default); // Act - await _dataSetAwaiter.WaitFilesProcessedOrFailedAsync(datasSet.Id, TimeSpan.Zero, default); + await _dataSetAwaiter.WaitFilesProcessedOrFailedAsync(dataSet.Id, TimeSpan.Zero, default); // Assert - var dataSetWithStauses = await _dataSetsClient.FileUploadStatusAsync(datasSet.Id, default); - dataSetWithStauses.Dataset.Files + var dataSetWithStatuses = await _dataSetsClient.FileUploadStatusAsync(dataSet.Id, default); + dataSetWithStatuses.Dataset.Files .All(f => f.Status is FileStatus.Processed or FileStatus.Failed) .Should().BeTrue(); } diff --git a/IndicoV2.IntegrationTests/GraphQLRequest/GraphQLRequestTests.cs b/IndicoV2.IntegrationTests/GraphQLRequest/GraphQLRequestTests.cs index db7cf20e..18785b9f 100644 --- a/IndicoV2.IntegrationTests/GraphQLRequest/GraphQLRequestTests.cs +++ b/IndicoV2.IntegrationTests/GraphQLRequest/GraphQLRequestTests.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using FluentAssertions; +using IndicoV2.DataSets.Models; using IndicoV2.IntegrationTests.Utils; using NUnit.Framework; using Unity; @@ -35,7 +36,18 @@ query ListDatasets($limit: Int){ dynamic variables = new { limit = 1 }; var request = _indicoClient.GraphQLRequest(); var result = await request.Call(query, operationName, variables); - result.Should().NotBeNull(); + foreach (var datasetJson in result.GetValue("datasetsPage").GetValue("datasets")) + { + var dataset = new DataSetFull() + { + Id = datasetJson.GetValue("id"), + Name = datasetJson.GetValue("name"), + RowCount = datasetJson.GetValue("rowCount") + }; + dataset.Id.Should().BeGreaterOrEqualTo(0); + dataset.Name.Should().NotBeNullOrEmpty(); + dataset.RowCount.Should().BeGreaterThan(0); + } } } } diff --git a/IndicoV2.IntegrationTests/Models/ModelClientTests.cs b/IndicoV2.IntegrationTests/Models/ModelClientTests.cs index 99252331..2798aa36 100644 --- a/IndicoV2.IntegrationTests/Models/ModelClientTests.cs +++ b/IndicoV2.IntegrationTests/Models/ModelClientTests.cs @@ -61,8 +61,8 @@ public async Task GetGroup_ShouldReturnModelGroup() } - [TestCase("Invoice Date: 2012-01-02")] - [TestCase("Invoice Date: 2012-02-03 Invoice Number: 123Test")] + [TestCase("AT&T")] + [TestCase("AT&T Xfinity T-Mobile")] public async Task Predict_ShouldReturnPrediction(params string[] data) { // Arrange @@ -75,12 +75,11 @@ public async Task Predict_ShouldReturnPrediction(params string[] data) // Assert predictionResults.Count.Should().Be(data.Length); - var firstPrediction = predictionResults.First().First(); firstPrediction.Label.Should().NotBeNullOrEmpty(); firstPrediction.Text.Should().NotBeNullOrEmpty(); - firstPrediction.Start.Should().BeGreaterThan(0); + firstPrediction.Start.Should().BeGreaterOrEqualTo(0); firstPrediction.End.Should().BeGreaterThan(0); firstPrediction.Confidence.Should().NotBeEmpty(); diff --git a/IndicoV2.IntegrationTests/Reporting/ReportingClientTests.cs b/IndicoV2.IntegrationTests/Reporting/ReportingClientTests.cs index b66a2aed..b5948957 100644 --- a/IndicoV2.IntegrationTests/Reporting/ReportingClientTests.cs +++ b/IndicoV2.IntegrationTests/Reporting/ReportingClientTests.cs @@ -41,7 +41,7 @@ public async Task SnapReportAsync_ShouldGenerateReport() [Test] public async Task ChangeReportAsync_ShouldGenerateReport() { - var jobId = (await _userReportingClient.CreateChangelogReportAsync(null, null, null, default)) + var jobId = (await _userReportingClient.CreateChangelogReportAsync(DateTime.Now, DateTime.Today, null, default)) .UserChangelogReport.JobId; await AssertJobGeneratesNonEmptyReport(jobId); diff --git a/IndicoV2.IntegrationTests/Submissions/SubmissionClientTests.cs b/IndicoV2.IntegrationTests/Submissions/SubmissionClientTests.cs index b86743f4..9edb84a5 100644 --- a/IndicoV2.IntegrationTests/Submissions/SubmissionClientTests.cs +++ b/IndicoV2.IntegrationTests/Submissions/SubmissionClientTests.cs @@ -219,6 +219,12 @@ public async Task ListSubmissions_SubmissionFilterReviewInProgress_ShouldFetchSu submissions.PageInfo.Should().NotBeNull(); submissions.Data.Should().NotBeNull(); submissions.Data.Should().HaveCount(0); + + foreach (Submission submission in submissions.Data) + { + submission.Id.Should().BeGreaterThan(0); + submission.ReviewInProgress.Should().NotBeTrue(); + } } @@ -242,12 +248,41 @@ public async Task ListSubmissions_SubmissionFilterCreatedAt_ShouldFetchSubmissio submissions.Should().NotBeNull(); submissions.PageInfo.Should().NotBeNull(); submissions.Data.Should().NotBeNull(); - var submission = submissions.Data.First(); // Assert submissions.Data.Should().HaveCountGreaterThan(0); - submission.Id.Should().BeGreaterThan(0); - submission.Status.Should().BeOfType(); + foreach (Submission submission in submissions.Data) + { + submission.Id.Should().BeGreaterThan(0); + submission.CreatedAt.Value.Should().BeLessThan(TimeSpan.FromTicks(DateTime.Now.Ticks)); + } + } + + + [Test] + public async Task ListSubmissions_SubmissionFilterStatus_ShouldFetchSubmissions() + { + // Arrange + var listData = await _dataHelper.Submissions().ListAnyAsync(_workflowId); + var filters = new SubmissionFilter + { + Status = SubmissionStatus.PENDING_AUTO_REVIEW + }; + + // Act + var submissions = await _submissionsClient.ListAsync(null, new List { listData.workflowId }, filters, 0, 10); + + submissions.Should().NotBeNull(); + submissions.PageInfo.Should().NotBeNull(); + submissions.Data.Should().NotBeNull(); + // Assert + submissions.Data.Should().HaveCountGreaterThan(0); + foreach (Submission submission in submissions.Data) + { + submission.Id.Should().BeGreaterThan(0); + submission.Status.Should().BeOfType(); + submission.Status.Should().Be(SubmissionStatus.PENDING_AUTO_REVIEW); + } } diff --git a/IndicoV2/Jobs/JobsClient.cs b/IndicoV2/Jobs/JobsClient.cs index a92171af..444b520b 100644 --- a/IndicoV2/Jobs/JobsClient.cs +++ b/IndicoV2/Jobs/JobsClient.cs @@ -29,7 +29,7 @@ public async Task GetStatusAsync(string jobId, CancellationToken canc public async Task GetResultAsync(string jobId, CancellationToken cancellationToken = default) { var result = await _strawberryShake.Jobs().GetResultAsync(jobId, cancellationToken); - // use json decoder to decode result into whatever tresult would be + // use json decoder to decode result into whatever TResult would be return JsonConvert.DeserializeObject(result.Job.Result); }