public void Test_GetPostCodeUnitCount() { var result = testCandidate.GetPostcodeUnitCount("abc", Guid.NewGuid()); Assert.NotNull(result.Result); Assert.AreEqual(result.Result, 5); }
public async Task <int> GetPostCodeUnitCount(string searchText) { string methodName = typeof(UnitManagerController) + "." + nameof(GetPostCodeUnitCount); using (loggingHelper.RMTraceManager.StartTrace("WebService.GetPostCodeUnitCount")) { loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerControllerMethodEntryEventId); if (string.IsNullOrEmpty(searchText)) { throw new ArgumentNullException(nameof(searchText)); } try { var postCodeUnitCount = await unitLocationBusinessService.GetPostcodeUnitCount(searchText, CurrentUserUnit); loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerControllerMethodExitEventId); return(postCodeUnitCount); } catch (AggregateException ae) { foreach (var exception in ae.InnerExceptions) { loggingHelper.Log(exception, TraceEventType.Error); } var realExceptions = ae.Flatten().InnerException; throw realExceptions; } } }