public async Task Test_GetPostcodeUnitCountValid()
        {
            var actualResult = await testCandidate.GetPostcodeUnitCount(searchInputDataDto);

            Assert.IsNotNull(actualResult);
            Assert.IsTrue(actualResult == 1);
        }
Exemple #2
0
        /// <summary>
        /// Get the count of post code
        /// </summary>
        /// <param name="searchText">The text to be searched</param>
        /// <param name="userUnit">Guid userUnit</param>
        /// <returns>The total count of post code</returns>
        public async Task <int> GetPostcodeUnitCount(string searchText, Guid userUnit)
        {
            string methodName = typeof(UnitLocationBusinessService) + "." + nameof(GetPostcodeUnitCount);

            using (loggingHelper.RMTraceManager.StartTrace("Business.GetPostcodeUnitCount"))
            {
                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 postCodeUnitCount = await postCodeDataService.GetPostcodeUnitCount(searchInputs).ConfigureAwait(false);

                loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerBusinessServiceMethodExitEventId);
                return(postCodeUnitCount);
            }
        }