예제 #1
0
        public async Task Test_CreateDeliveryPoint_PositiveScenario()
        {
            CreateDeliveryPointModelDTO result = await testCandidate.CreateDeliveryPoint(addDeliveryPointDTO);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Message == "Delivery Point created successfully");
        }
예제 #2
0
        public async Task <IActionResult> CreateDeliveryPoint([FromBody] AddDeliveryPointDTO deliveryPointDto)
        {
            try
            {
                using (loggingHelper.RMTraceManager.StartTrace("WebService.AddDeliveryPoint"))
                {
                    CreateDeliveryPointModelDTO createDeliveryPointModelDTO = null;
                    string methodName = typeof(DeliveryPointController) + "." + nameof(CreateDeliveryPoint);
                    loggingHelper.LogMethodEntry(methodName, priority, entryEventId);

                    if (!ModelState.IsValid)
                    {
                        return(BadRequest(ModelState));
                    }

                    createDeliveryPointModelDTO = await businessService.CreateDeliveryPoint(deliveryPointDto);

                    loggingHelper.LogMethodExit(methodName, priority, exitEventId);

                    return(Ok(createDeliveryPointModelDTO));
                }
            }
            catch (AggregateException ae)
            {
                foreach (var exception in ae.InnerExceptions)
                {
                    loggingHelper.Log(exception, TraceEventType.Error);
                }

                var realExceptions = ae.Flatten().InnerException;
                throw realExceptions;
            }
        }