public void GetDescriptorIncorrectRequestTypeThrowsException()
        {
            var    request = new GetTenureListRequest();
            Action act     = () => _transactionDateRange.GetDescriptor(_queryContainerDescriptor, request);

            act.Should().Throw <ArgumentNullException>().WithMessage($"Value cannot be null. (Parameter '{nameof(request)}')");
        }
Ejemplo n.º 2
0
        public void CreateNotQueryableTransactionReturnsDefaultFilter()
        {
            var request           = new GetTenureListRequest();
            var transactionFilter = _filterFactory.Create <QueryableSender, GetTenureListRequest>(request);

            transactionFilter.Should().BeOfType <DefaultFilter <QueryableSender> >();
        }
Ejemplo n.º 3
0
        public void CreateQueryableTransactionTypeReturnsTransactionsFilter()
        {
            var request           = new GetTenureListRequest();
            var transactionFilter = _filterFactory.Create <QueryableTransaction, GetTenureListRequest>(request);

            transactionFilter.Should().BeOfType <TransactionsFilter>();
        }
Ejemplo n.º 4
0
        public async Task GetTenureListShouldCallGetTenureListUseCase()
        {
            // given
            var request  = new GetTenureListRequest();
            var response = new GetTenureListResponse();

            _mockGetTenureListUseCase.Setup(x => x.ExecuteAsync(request)).ReturnsAsync(response);

            // when
            await _classUnderTest.GetTenureList(request).ConfigureAwait(false);

            // then
            _mockGetTenureListUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);
        }
        public async Task <GetTenureListResponse> GetListOfTenures(GetTenureListRequest query)
        {
            var searchResponse = await _elasticSearchWrapper.Search <QueryableTenure, GetTenureListRequest>(query).ConfigureAwait(false);

            var tenureListResponse = new GetTenureListResponse();

            tenureListResponse.Tenures.AddRange(searchResponse.Documents.Select(queryableTenure =>
                                                                                queryableTenure.Create())
                                                );

            tenureListResponse.SetTotal(searchResponse.Total);

            return(tenureListResponse);
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> GetTenureList([FromQuery] GetTenureListRequest request)
        {
            try
            {
                var tenuresSearchResult = await _getTenureListUseCase.ExecuteAsync(request).ConfigureAwait(false);

                var apiResponse = new APIResponse <GetTenureListResponse>(tenuresSearchResult);
                apiResponse.Total = tenuresSearchResult.Total();

                return(new OkObjectResult(apiResponse));
            }
            catch (Exception e)
            {
                LambdaLogger.Log(e.Message + e.StackTrace);
                return(new BadRequestObjectResult(e.Message));
            }
        }
 public async Task <GetTenureListResponse> ExecuteAsync(GetTenureListRequest housingSearchRequest)
 {
     return(await _searchGateway.GetListOfTenures(housingSearchRequest).ConfigureAwait(false));
 }