Beispiel #1
0
        /// <summary>
        /// Fetch the post code for advanced Search.
        /// </summary>
        /// <param name="searchText">Text to search</param>
        /// <param name="userUnit">userUnit Guid Id</param>
        /// <returns>list of PostcodeDTO</returns>
        public async Task <IEnumerable <PostcodeDTO> > GetPostcodeUnitForAdvanceSearch(string searchText, Guid userUnit)
        {
            string methodName = typeof(UnitLocationBusinessService) + "." + nameof(GetPostcodeUnitForAdvanceSearch);

            using (loggingHelper.RMTraceManager.StartTrace("Business.GetPostcodeUnitForAdvanceSearch"))
            {
                loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerBusinessServiceMethodEntryEventId);

                // reference data value for Postcode with Category - Postcode Type
                Guid postcodeTypeGUID           = unitManagerIntegrationService.GetReferenceDataGuId(PostCodeType, PostCodeTypeCategory.Postcode.GetDescription()).Result;
                SearchInputDataDto searchInputs = new SearchInputDataDto
                {
                    SearchText         = searchText,
                    UserUnitLocationId = userUnit,
                    PostcodeTypeGUID   = postcodeTypeGUID,
                    SearchResultCount  = SearchResultCount
                };

                var postcodeUnits = await postCodeDataService.GetPostcodeUnitForAdvanceSearch(searchInputs).ConfigureAwait(false);

                List <PostcodeDTO> postCodeList = postcodeUnits.Select(x => new PostcodeDTO
                {
                    PostcodeUnit = x.PostcodeUnit
                }).ToList();

                loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerBusinessServiceMethodExitEventId);
                return(postCodeList);
            }
        }
        public async Task Test_GetPostcodeUnitForAdvanceSearchValid()
        {
            var actualResult = await testCandidate.GetPostcodeUnitForAdvanceSearch(searchInputDataDto);

            Assert.IsNotNull(actualResult);
            Assert.IsTrue(actualResult.ToList().Count == 1);
        }