Exemplo n.º 1
0
        public void Setup()
        {
            mocks = new MockRepository();
            _postUtil = mocks.CreateMock<IWebPoster>();

            _dt = new DhlTracker(_postUtil, "user", "pass");
        }
        public void Setup()
        {
            mocks = new MockRepository();
            _postUtil = mocks.CreateMock<IWebPoster>();

            _dt = new DhlScreenScrapeTracker(_postUtil);
        }
        public void SetUp()
        {
            _mockPoster = MockRepository.GenerateStub<IWebPoster>();
            _mockThreadSleeper = MockRepository.GenerateStub<IThreadSleeper>();

            _rpu = new PackageTrackrRetryPostUtility(_mockPoster, _mockThreadSleeper);
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        public void SetUp()
        {
            mocks = new MockRepository();
            _postUtil = mocks.CreateMock<IWebPoster>();

            _tracker = new UspsTracker(_postUtil, "userName", "password", true);
        }
Exemplo n.º 6
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;
        }
        public void SetUp()
        {
            _mockPoster        = MockRepository.GenerateStub <IWebPoster>();
            _mockThreadSleeper = MockRepository.GenerateStub <IThreadSleeper>();

            _rpu = new PackageTrackrRetryPostUtility(_mockPoster, _mockThreadSleeper);
        }
Exemplo n.º 8
0
        private ServiceProxy CreateServiceProxy()
        {
            _serializer = MockRepository.GenerateStub<IXmlSerializer>();
            _serializer.Stub(s => s.Serialize<Request>(null)).IgnoreArguments().Return(String.Empty);
            _serializer.Stub(s => s.Deserialize<Response>(String.Empty)).IgnoreArguments().Return(null);

            _poster = MockRepository.GenerateStub<IWebPoster>();
            _poster.Stub(p => p.Post(String.Empty)).IgnoreArguments().Return(String.Empty);

            return new ServiceProxy(_serializer, _poster);
        }
Exemplo n.º 9
0
        /// <summary>
        ///		Creates a new instance of the <see cref="UspsTracker"/> class.
        /// </summary>
        /// <param name="postUtility">
        ///		The <see cref="IWebPoster"/> to use to send and receive data
        ///		from the API service.
        /// </param>
        /// <param name="userName">
        ///		A valid USPS API user name.
        /// </param>
        /// <param name="password">
        ///		A valid USPS API password.
        /// </param>
        /// <param name="production">
        ///		A boolean indicating if this tracker is being used in development or production.
        /// </param>
        public UspsTracker(IWebPoster postUtility, string userName, string password, bool production)
        {
            _postUtility = postUtility;
            _userName = userName;
            _password = password;

            if (production)
                _serviceUrl = PROD_URL;
            else
                _serviceUrl = DEV_URL;
        }
Exemplo n.º 10
0
        /// <summary>
        ///		Creates a new instance of the <see cref="UspsTracker"/> class.
        /// </summary>
        /// <param name="postUtility">
        ///		The <see cref="IWebPoster"/> to use to send and receive data
        ///		from the API service.
        /// </param>
        /// <param name="userName">
        ///		A valid USPS API user name.
        /// </param>
        /// <param name="password">
        ///		A valid USPS API password.
        /// </param>
        /// <param name="production">
        ///		A boolean indicating if this tracker is being used in development or production.
        /// </param>
        public UspsTracker(IWebPoster postUtility, string userName, string password, bool production)
        {
            _postUtility = postUtility;
            _userName    = userName;
            _password    = password;

            if (production)
            {
                _serviceUrl = PROD_URL;
            }
            else
            {
                _serviceUrl = DEV_URL;
            }
        }
 /// <summary>
 ///		Creates a new instance of the <see cref="PackageTrackrRetryPostUtility"/>.
 /// </summary>
 /// <param name="poster">
 ///		The base <see cref="IWebPoster"/> that will be retried if necessary.
 /// </param>
 public PackageTrackrRetryPostUtility(IWebPoster poster, IThreadSleeper threadSleeper)
 {
     _poster = poster;
     _threadSleeper = threadSleeper;
 }
Exemplo n.º 12
0
 public DhlTracker(IWebPoster postUtility, string username, string password)
 {
     _postUtility = postUtility;
     _username = username;
     _password = password;
 }
 /// <summary>
 ///		Creates a new instance of the <see cref="PackageTrackrRetryPostUtility"/>.
 /// </summary>
 /// <param name="poster">
 ///		The base <see cref="IWebPoster"/> that will be retried if necessary.
 /// </param>
 public PackageTrackrRetryPostUtility(IWebPoster poster, IThreadSleeper threadSleeper)
 {
     _poster        = poster;
     _threadSleeper = threadSleeper;
 }
 /// <summary>
 ///		Creates a new instance of the <see cref="DhlScreenScrapeTracker"/>
 /// </summary>
 /// <param name="postUtility">
 ///		The <see cref="IWebPoster"/> to use to make the web requests.
 /// </param>
 public DhlScreenScrapeTracker(IWebPoster postUtility)
 {
     _postUtility = postUtility;
 }
Exemplo n.º 15
0
 /// <summary>
 ///		Creates a new instance of the <see cref="DhlScreenScrapeTracker"/>
 /// </summary>
 /// <param name="postUtility">
 ///		The <see cref="IWebPoster"/> to use to make the web requests.
 /// </param>
 public DhlScreenScrapeTracker(IWebPoster postUtility)
 {
     _postUtility = postUtility;
 }
Exemplo n.º 16
0
 public DhlTracker(IWebPoster postUtility, string username, string password)
 {
     _postUtility = postUtility;
     _username    = username;
     _password    = password;
 }