예제 #1
0
        public async Task GetAssetListShouldCallGetAssetListUseCase()
        {
            // given
            var request  = new GetAssetListRequest();
            var response = new GetAssetListResponse();

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

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

            // then
            _mockGetAssetListUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);
        }
        public async Task <GetAssetListResponse> GetListOfAssets(GetAssetListRequest query)
        {
            var searchResponse = await _elasticSearchWrapper.Search <QueryableAsset, GetAssetListRequest>(query).ConfigureAwait(false);

            var assetListResponse = new GetAssetListResponse();

            assetListResponse.Assets.AddRange(searchResponse.Documents.Select(queryableAsset =>
                                                                              queryableAsset.Create())
                                              );

            assetListResponse.SetTotal(searchResponse.Total);

            return(assetListResponse);
        }