Example #1
0
        public async void GetBookings_Should_Call_IBittnRepository_RetrieveBookings()
        {
            RetrieveBookingsRequest arg = null;

            _bittnRepository.RetrieveBookings(Arg.Do <RetrieveBookingsRequest>(a => arg = a)).Returns(new RetrieveBookingsResponse());

            var request = new GetBookingsRequest
            {
                PageIndex = 123
            };

            await _service.GetBookings(request);

            await _bittnRepository.Received(1).RetrieveBookings(Arg.Any <RetrieveBookingsRequest>());

            arg.ItemsPerPage.Should().BeNull();
            arg.PageIndex.Should().Be(request.PageIndex);
        }
Example #2
0
        public async Task <GetBookingsResponse> GetBookings(GetBookingsRequest request)
        {
            var response = await _bittnRepository.RetrieveBookings(new RetrieveBookingsRequest
            {
                PageIndex      = request.PageIndex,
                SortField      = request.SortField,
                SortDescending = request.SortDescending
            });

            return(new GetBookingsResponse
            {
                Data = response.Data,
                PrevPageIndex = response.PrevPageIndex,
                NextPageIndex = response.NextPageIndex
            });
        }