public async Task <PostcodeSectorDTO> GetPostcodeSectorByUdprn(int udprn) { string methodName = typeof(UnitManagerController) + "." + nameof(GetPostcodeSectorByUdprn); using (loggingHelper.RMTraceManager.StartTrace("WebService.GetPostcodeSectorByUdprn")) { if (udprn.Equals(0)) { throw new ArgumentNullException(ErrorConstants.Error_NonZero, nameof(udprn)); } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerControllerMethodEntryEventId, LoggerTraceConstants.Title); try { var getPostCodeSectorByUDPRN = await unitLocationBusinessService.GetPostcodeSectorByUdprn(udprn); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerControllerMethodExitEventId, LoggerTraceConstants.Title); return(getPostCodeSectorByUDPRN); } catch (AggregateException ae) { foreach (var exception in ae.InnerExceptions) { loggingHelper.Log(exception, TraceEventType.Error); } var realExceptions = ae.Flatten().InnerException; throw realExceptions; } } }
public async Task Test_GetPostCodeSectorByUDPRN() { var result = await testCandidate.GetPostcodeSectorByUdprn(12345); Assert.NotNull(result); Assert.AreEqual(result.District, null); Assert.AreEqual(result.Sector, null); }