public async Task <IActionResult> DeleteDeliveryPointWithAssociatedLocations(Guid deliveryPointId, string reasonCode, string reasonText) { if (deliveryPointId == Guid.Empty) { throw new ArgumentNullException(nameof(deliveryPointId)); } using (loggingHelper.RMTraceManager.StartTrace("WebService.DeleteDeliveryPointWithAssociatedLocations")) { try { string methodName = typeof(DeliveryPointController) + "." + nameof(DeleteDeliveryPointWithAssociatedLocations); loggingHelper.LogMethodEntry(methodName, priority, entryEventId); var isDeliveryPointDeleted = await businessService.DeleteDeliveryPointWithAssociatedLocations(deliveryPointId, reasonCode, reasonText, this.UserName); loggingHelper.LogMethodExit(methodName, priority, exitEventId); return(Ok(isDeliveryPointDeleted)); } 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_UserDeleteDeliveryPoint_PositiveScenario() { reasonCode = "Demolished"; reasonText = "No reason"; userName = "******"; mockDeliveryPointsDataService.Setup(x => x.DeleteDeliveryPointWithAssociatedLocations(It.IsAny <Guid>())).ReturnsAsync(true); bool expectedresult = await testCandidate.DeleteDeliveryPointWithAssociatedLocations(id, reasonCode, reasonText, userName); Assert.IsNotNull(expectedresult); Assert.IsTrue(expectedresult); }