public void Test_SavePostalAddressForNYB_PositiveScenario() { List <PostalAddressDTO> lstPostalAddressDTO = new List <PostalAddressDTO>() { new PostalAddressDTO() { ID = Guid.NewGuid(), UDPRN = 14856 } }; var result = testCandidate.SavePostalAddressForNYB(lstPostalAddressDTO, "NYB.CSV"); Assert.IsNotNull(result); Assert.IsTrue(result.Result); }
public async Task <IActionResult> SaveAddressdetails(string strFileName, [FromBody] List <PostalAddressDTO> lstAddressDetails) { try { using (loggingHelper.RMTraceManager.StartTrace("Controller.SaveAddressdetails")) { string methodName = typeof(PostalAddressController) + "." + nameof(SaveAddressdetails); loggingHelper.LogMethodEntry(methodName, priority, entryEventId); bool isSaved = false; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (lstAddressDetails != null && lstAddressDetails.Count > 0) { isSaved = await businessService.SavePostalAddressForNYB(lstAddressDetails, strFileName); return(Ok(isSaved)); } loggingHelper.LogMethodExit(methodName, priority, exitEventId); return(Ok(isSaved)); } } catch (AggregateException ex) { foreach (var exception in ex.InnerExceptions) { loggingHelper.Log(exception, System.Diagnostics.TraceEventType.Error); } var realExceptions = ex.Flatten().InnerException; throw realExceptions; } }