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;
        }
        public void Pass_On_Valid_Tracking_Data()
        {
            var td = new TrackingData();
            _eht = new ErrorHandlerTracker(_mockTracker);

            Expect.Call(_mockTracker.GetTrackingData("Pass_On_Valid_Tracking_Data")).Return(td);

            _mocks.ReplayAll();

            Assert.AreEqual(td, _eht.GetTrackingData("Pass_On_Valid_Tracking_Data"));

            _mocks.VerifyAll();
        }
        public void Pass_On_Valid_Tracking_Data()
        {
            var td = new TrackingData();

            _eht = new ErrorHandlerTracker(_mockTracker);

            Expect.Call(_mockTracker.GetTrackingData("Pass_On_Valid_Tracking_Data")).Return(td);

            _mocks.ReplayAll();

            Assert.AreEqual(td, _eht.GetTrackingData("Pass_On_Valid_Tracking_Data"));

            _mocks.VerifyAll();
        }
        public void Suppress_Upstream_Exception()
        {
            var testException = new Exception("test");

            _eht = new ErrorHandlerTracker(_mockTracker);

            Expect.Call(_mockTracker.GetTrackingData("Suppress_Upstream_Exception")).Throw(testException);

            _mocks.ReplayAll();

            TrackingData td = _eht.GetTrackingData("Suppress_Upstream_Exception");
            Assert.AreEqual(true, td is ErrorTrackingData);
            Assert.AreEqual(testException, ((ErrorTrackingData) td).Exception);

            _mocks.VerifyAll();
        }
        public void Suppress_Upstream_Exception()
        {
            var testException = new Exception("test");

            _eht = new ErrorHandlerTracker(_mockTracker);

            Expect.Call(_mockTracker.GetTrackingData("Suppress_Upstream_Exception")).Throw(testException);

            _mocks.ReplayAll();

            TrackingData td = _eht.GetTrackingData("Suppress_Upstream_Exception");

            Assert.AreEqual(true, td is ErrorTrackingData);
            Assert.AreEqual(testException, ((ErrorTrackingData)td).Exception);

            _mocks.VerifyAll();
        }