/// <summary>
        /// Creates the T2G services stub.
        /// </summary>
        protected void CreateT2GServicesStub()
        {
            _identificationServiceStub = new T2GIdentificationServiceStub();
            _fileTransferServiceStub   = new T2GFileTransferServiceStub(_identificationServiceStub);
            _vehicleInfoServiceStub    = new T2GVehicleInfoServiceStub(_identificationServiceStub);
            _notificationServiceStub   = new T2GNotificationServiceStub();

            Uri identificationAddress = new Uri(IdentificationServiceUrl);
            Uri fileTransferAddress   = new Uri(FileTransferServiceUrl);
            Uri vehicleInfoAddress    = new Uri(VehicleInfoServiceUrl);
            Uri notificationAddress   = new Uri(ServiceConfiguration.T2GServiceNotificationUrl);

            _hostIdentificationService = new ServiceHost(_identificationServiceStub, identificationAddress);
            _hostFileTransferService   = new ServiceHost(_fileTransferServiceStub, fileTransferAddress);
            _hostVehicleInfoService    = new ServiceHost(_vehicleInfoServiceStub, vehicleInfoAddress);
            _hostNotificationService   = new ServiceHost(_notificationServiceStub, notificationAddress);

            _hostIdentificationService.Open();
            _hostFileTransferService.Open();
            _hostVehicleInfoService.Open();
            _hostNotificationService.Open();
        }
        public void TearDown()
        {
            if (_datapackageServiceStub != null)
            {
                _datapackageServiceStub.Dispose();
                _datapackageServiceStub = null;
            }

            if (_requestManager != null)
            {
                _requestManager.Dispose();
                _requestManager = null;
            }

            foreach (ServiceHost service in new ServiceHost[] { _hostVehicleInfoService, _hostFileTransferService, _hostIdentificationService, _hostNotificationService, _hostTrainDataPackageService })
            {
                if (service == null)
                {
                    continue;
                }

                if (service.State == CommunicationState.Faulted)
                {
                    service.Abort();
                }

                service.Close();
            }

            if (_vehicleInfoServiceStub != null)
            {
                _vehicleInfoServiceStub.Dispose();
            }

            if (_baselineStatusUpdater != null)
            {
                _baselineStatusUpdater.Dispose();
            }

            _hostIdentificationService   = null;
            _hostFileTransferService     = null;
            _hostVehicleInfoService      = null;
            _hostNotificationService     = null;
            _hostTrainDataPackageService = null;
            _fileTransferServiceStub     = null;
            _identificationServiceStub   = null;
            _vehicleInfoServiceStub      = null;
            _notificationServiceStub     = null;
            _trainDataPackageServiceStub = null;
            _baselineStatusUpdater       = null;
            DataPackageService.Uninitialize();
            T2GManagerContainer.T2GManager = null;
            _t2gManager     = null;
            _sessionManager = null;
            _requestFactory = null;

            if (_dataStoreServiceStub != null)
            {
                _dataStoreServiceStub.Dispose();
                _dataStoreServiceStub = null;
            }

            _remoteDataStoreFactoryMock = null;

            TestContext currentContext = TestContext.CurrentContext;

            Console.Out.WriteLine("===================================");
            Console.Out.WriteLine("END TEST {0}", currentContext.Test.Name);
            Console.Out.WriteLine("===================================");
        }