Skip to content
Snippets Groups Projects
Commit bb530bd7 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

fix: added offset and limit to case request

parent 5fdc910d
No related branches found
No related tags found
No related merge requests found
......@@ -285,8 +285,12 @@ public abstract class FitConnectClient : IFitConnectClient {
Logger?.LogInformation("Submission completed {Status}", result);
}
public async Task<IEnumerable<Case>> GetCases() {
var dto = await CasesService.GetCases();
public async Task<CaseDto?> GetCasesResult(int offset = 0, int limit = 500) {
return await CasesService.GetCases(offset, limit);
}
public async Task<IEnumerable<Case>> GetCases(int offset = 0, int limit = 500) {
var dto = await GetCasesResult(offset, limit);
return dto?.Cases ?? new List<Case>();
}
......@@ -316,4 +320,4 @@ public static class FitConnectClientExtensions {
RestCallService.Proxy = proxy;
return caller;
}
}
}
\ No newline at end of file
......@@ -47,5 +47,6 @@ public interface ISender : IFitConnectClient {
Task AcceptReplyAsync(IReceivedReply reply, params Problems[] problems);
Task RejectReplyAsync(IReceivedReply reply, params Problems[] problems);
Task RejectReplyAsync(Guid reply, params Problems[] problems);
Task<IEnumerable<Case>> GetCases();
Task<IEnumerable<Case>> GetCases(int offset = 0, int limit = 500);
Task<CaseDto> GetCasesResult(int offset = 0, int limit = 500);
}
using FitConnect.Models;
using FitConnect.Models.v1.Api;
using FitConnect.Services.Interfaces;
using FitConnect.Services.Models.v1.Submission;
namespace FitConnect.Interfaces.Subscriber;
......@@ -58,7 +59,8 @@ public interface ISubscriber : IFitConnectClient {
public Task<SentSubmission> SendReplyAsync(SendableReply replySubmission);
Task<AvailableRepliesDto> GetReplies(int offset, int limit);
Task<IEnumerable<Case>> GetCases();
Task<IEnumerable<Case>> GetCases(int offset = 0 , int limit = 500);
Task<CaseDto> GetCasesResult(int offset = 0 , int limit = 500);
}
public record Case(Guid CaseId, Guid DestinationId);
......@@ -357,38 +357,34 @@ public class ReplyChannelTest : EndToEndTestBase {
[Test]
[Order(63)]
[Ignore("Was just used for debugging")]
public void T063_List_Cases() {
var sender0Cases = ClientFactory.CreateSenderClient(_environment,
_senderConfigs[0].ClientId, _senderConfigs[0].ClientSecret,
Logger
).GetCases().Result.ToList();
sender0Cases.Should().NotBeNullOrEmpty();
sender0Cases.Count.Should().BeGreaterOrEqualTo(1);
).GetCasesResult(0,1).Result;
sender0Cases.TotalCount.Should().BeGreaterOrEqualTo(1);
var sender1Cases = ClientFactory.CreateSenderClient(_environment,
_senderConfigs[1].ClientId, _senderConfigs[1].ClientSecret,
Logger
).GetCases().Result.ToList();
sender1Cases.Should().NotBeNullOrEmpty();
sender1Cases.Count.Should().BeGreaterOrEqualTo(1);
).GetCasesResult(0,1).Result;
sender1Cases.TotalCount.Should().BeGreaterOrEqualTo(1);
var subscriberCases = Subscriber.GetCases().Result.ToList();
subscriberCases.Should().NotBeNullOrEmpty();
subscriberCases.Count.Should().BeGreaterOrEqualTo(1);
var subscriberCases = Subscriber.GetCasesResult(0,1).Result;
subscriberCases.TotalCount.Should().BeGreaterOrEqualTo(1);
Console.WriteLine($"Found {sender0Cases.Count,5} cases for sender {_senderConfigs[0].ClientId}");
Console.WriteLine($"Found {sender1Cases.Count,5} cases for sender {_senderConfigs[1].ClientId}");
Console.WriteLine($"Found {subscriberCases.Count,5} cases for subscriber");
Console.WriteLine($"Found {sender0Cases.TotalCount,5} cases for sender {_senderConfigs[0].ClientId}");
Console.WriteLine($"Found {sender1Cases.TotalCount,5} cases for sender {_senderConfigs[1].ClientId}");
Console.WriteLine($"Found {subscriberCases.TotalCount,5} cases for subscriber");
subscriberCases.Count.Should()
.NotBe(sender0Cases.Count, "Sender 0 should have less cases than the subscriber has");
.NotBe(sender0Cases.TotalCount, "Sender 0 should have less cases than the subscriber has");
subscriberCases.Count.Should()
.NotBe(sender1Cases.Count, "Sender 1 should have less cases than the subscriber has");
sender0Cases.Count.Should().NotBe(sender1Cases.Count, "The sender have to be different");
.NotBe(sender1Cases.TotalCount, "Sender 1 should have less cases than the subscriber has");
sender0Cases.Count.Should().NotBe(sender1Cases.TotalCount, "The sender have to be different");
}
[Test]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment