Пример #1
0
        public async Task <IActionResult> QueryByText(string queryName, string queriedPhrase, int pageLimit)
        {
            var queryInst = _appConfigInstance.GetQueryInstance(queryName);

            _logger.LogDebug("SearchByTextCtrl: Found the query {queryName}", queryName);

            if (queryInst == null)
            {
                return(NotFound());
            }

            var requestMsg = new RequestMsg(queriedPhrase)
            {
                QueriedInstance = queryInst,
                Limit           = pageLimit,
                Skip            = 0
            };

            var result = await _mediator.Send(requestMsg);

            return(result != null ? (IActionResult)Ok(result) : BadRequest());
        }
Пример #2
0
        public void Test_get_query_config_by_name(string queryName, bool expectedResult)
        {
            //arrange
            _gisAppConfig.AddQueryConfigs(FakeData.GetConfigurationData());

            //act
            QueryConfig config = _gisAppConfig.GetQueryInstance(queryName);

            //assert
            if (!expectedResult)
            {
                config.Should().BeNull();
            }
            else
            {
                config.Should().NotBeNull();
                config.Name.ToLower().Should().Be(queryName.ToLower());
            }
        }