public DeliverAverageJourneyTimeResponse GetDeliverAverageJourneyTimeResponse(DeliverAverageJourneyTimeRequest deliverAverageJourneyTimeRequest)
        {
            log.Info("New DeliverAverageJourneyTimeRequest received.");

            D2LogicalModel d2LogicalModel = deliverAverageJourneyTimeRequest.D2LogicalModel;
            FusedDataPublication fusedDataPublication = null;

            // Validate D2LogicalModel
            if (!ExampleDataCheckOk(d2LogicalModel))
            {
                throw new SoapException("Incoming request does not appear to be valid!", SoapException.ClientFaultCode);
            }

            // FusedDataPublication contains teh journey time, direction, code, region, etc.
            try
            {
                fusedDataPublication = (FusedDataPublication)d2LogicalModel.payloadPublication;

                if (fusedDataPublication != null && fusedDataPublication.fusedData[0] != null)
                {
                    // You could use the FusedDataPublication and extract the corresponding fields.

                    log.Debug("createdUtc is " + fusedDataPublication.fusedData[0].createdUtc.ToString());
                    log.Debug("Local is " + fusedDataPublication.fusedData[0].maxArrivalUtc.ToString());
                }

            }
            catch (Exception e)
            {
                log.Error("Error while obtaining FusedDataPublication.");
                log.Error(e.Message);
                throw new SoapException("Error while obtaining FusedDataPublication.", SoapException.ServerFaultCode, e);
            }

            DeliverAverageJourneyTimeResponse response = new DeliverAverageJourneyTimeResponse();
            response.status = "DeliverAverageJourneyTimeRequest: Successful Delivery";

            return response;
        }
        public void CheckErrorInGetDeliverAverageJourneyTimeResponseTest()
        {
            IAverageJourneyTimeService averageJourneyTimeService = new AverageJourneyTimeService();
            DeliverAverageJourneyTimeRequest deliverAverageJourneyTimeRequest = new DeliverAverageJourneyTimeRequest();

            model = null; // This will be checked by ExampleDataCheckOk(d2LogicalModel)

            deliverAverageJourneyTimeRequest.D2LogicalModel = model;
            string expected = "DeliverAverageJourneyTimeRequest: Successful Delivery";
            string actual;
            // This should cause a SoapException
            actual = (averageJourneyTimeService.GetDeliverAverageJourneyTimeResponse(deliverAverageJourneyTimeRequest)).status;

            Assert.AreEqual(expected, actual);
        }
        public void CheckValidGetDeliverAverageJourneyTimeResponseTest()
        {
            IAverageJourneyTimeService averageJourneyTimeService = new AverageJourneyTimeService();
            DeliverAverageJourneyTimeRequest deliverAverageJourneyTimeRequest = new DeliverAverageJourneyTimeRequest();
            deliverAverageJourneyTimeRequest.D2LogicalModel = model;
            string expected = "DeliverAverageJourneyTimeRequest: Successful Delivery";
            string actual;
            actual = (averageJourneyTimeService.GetDeliverAverageJourneyTimeResponse(deliverAverageJourneyTimeRequest)).status;

            Assert.AreEqual(expected, actual);
        }