Exemple #1
0
 public Task <CustomerSourceGetPagedListResponse> GetPagedListAsync(
     CustomerSourceGetPagedListRequest request,
     Dictionary <string, string> headers = default,
     CancellationToken ct = default)
 {
     return(_factory.PostAsync <CustomerSourceGetPagedListResponse>(
                _host + "/Customers/Sources/v1/GetPagedList", null, request, headers, ct));
 }
        public async Task <ActionResult <CustomerSourceGetPagedListResponse> > GetPagedList(
            CustomerSourceGetPagedListRequest request,
            CancellationToken ct = default)
        {
            var response = await _customerSourcesService.GetPagedListAsync(_userContext.AccountId, request, ct);

            return(ReturnIfAllowed(
                       response,
                       Roles.Customers,
                       response.Sources.Select(x => x.AccountId)));
        }
Exemple #3
0
        public async Task WhenGetPagedList_ThenSuccess()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            var name = "Test".WithGuid();
            await Task.WhenAll(
                _create.CustomerSource
                .WithName(name)
                .BuildAsync());

            var request = new CustomerSourceGetPagedListRequest
            {
                Name = name
            };

            var response = await _customerSourcesClient.GetPagedListAsync(request, headers);

            var results = response.Sources
                          .Skip(1)
                          .Zip(response.Sources, (previous, current) => current.CreateDateTime >= previous.CreateDateTime);

            Assert.NotEmpty(response.Sources);
            Assert.All(results, Assert.True);
        }