Exemple #1
0
        public async Task <IActionResult> DeleteDeliveryPoint(Guid id)
        {
            if (id == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(id));
            }
            using (loggingHelper.RMTraceManager.StartTrace("WebService.DeleteDeliveryPoint"))
            {
                try
                {
                    string methodName = typeof(DeliveryPointController) + "." + nameof(DeleteDeliveryPoint);
                    loggingHelper.LogMethodEntry(methodName, priority, entryEventId);

                    var isDeliveryPointDeleted = await businessService.DeleteDeliveryPoint(id);

                    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;
                }
            }
        }
Exemple #2
0
        public async Task Test_DeleteDeliveryPoint_PositiveScenario()
        {
            mockDeliveryPointsDataService.Setup(x => x.DeleteDeliveryPoint(It.IsAny <Guid>())).ReturnsAsync(true);
            bool expectedresult = await testCandidate.DeleteDeliveryPoint(id);

            Assert.IsNotNull(expectedresult);
            Assert.IsTrue(expectedresult);
        }