Ejemplo n.º 1
0
        public async Task WhenGetPagedList_ThenSuccess()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            var source = await _create.CustomerSource.BuildAsync();

            var customer = await _create.Customer
                           .WithSourceId(source.Id)
                           .BuildAsync();

            await Task.WhenAll(
                _create.CustomerComment
                .WithCustomerId(customer.Id)
                .BuildAsync(),
                _create.CustomerComment
                .WithCustomerId(customer.Id)
                .BuildAsync());

            var request = new CustomerCommentGetPagedListRequest
            {
                CustomerId = customer.Id
            };

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

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

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