示例#1
0
        public PackageTracker(IWebPoster webPoster, IGeocodeDb geocodeDb)
        {
            //Todo: This is a bad place to load these:
            var uspsUserName = WebConfigurationManager.AppSettings["UspsUserName"];
            var uspsPassword = WebConfigurationManager.AppSettings["UspsPassword"];

            var fedexKey = WebConfigurationManager.AppSettings["FedexKey"];
            var fedexPassword = WebConfigurationManager.AppSettings["FedexPassword"];
            var fedexAccountNumber = WebConfigurationManager.AppSettings["FedexAccountNumber"];
            var fedexMeterNumber = WebConfigurationManager.AppSettings["FedexMeterNumber"];

            var coreTrackers = new List<ITracker>();
            coreTrackers.Add(new Tracking.Simulation.SimulationTracker());
            coreTrackers.Add(new UpsTracker());
            coreTrackers.Add(new UspsTracker(new PostUtility(), uspsUserName, uspsPassword, true));
            coreTrackers.Add(new FedexTracker(new TrackService(), fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber, false));
            //coreTrackers.Add(new DhlTracker(new PostUtility(), "", "");

            var multiTracker = new MultiTracker(coreTrackers);
            var cacheTracker = new CacheTracker(multiTracker);
            var emptyTracker = new EmptyTrackingNumberTracker(cacheTracker);
            var loggingTracker = new LoggingTracker(emptyTracker);
            var sanitizerTracker = new TrackingNumberStandardizerTracker(loggingTracker);
            var geocodingTracker = new GeocodingTracker(sanitizerTracker, geocodeDb);
            var errorHandlerTracker = new ErrorHandlerTracker(geocodingTracker);

            _defaultTracker = errorHandlerTracker;
        }
示例#2
0
        public void UseDownstreamTracker()
        {
            var downstreamTracker = MockRepository.GenerateMock<ITracker>();
            var expectedTrackingData = new TrackingData();
            downstreamTracker.Expect(x => x.GetTrackingData("abc")).Return(expectedTrackingData);

            var t = new LoggingTracker(downstreamTracker);
            var actualTrackingData = t.GetTrackingData("abc");

            Assert.AreEqual(expectedTrackingData, actualTrackingData);
        }
示例#3
0
        public void UseDownstreamTracker()
        {
            var downstreamTracker    = MockRepository.GenerateMock <ITracker>();
            var expectedTrackingData = new TrackingData();

            downstreamTracker.Expect(x => x.GetTrackingData("abc")).Return(expectedTrackingData);

            var t = new LoggingTracker(downstreamTracker);
            var actualTrackingData = t.GetTrackingData("abc");

            Assert.AreEqual(expectedTrackingData, actualTrackingData);
        }