示例#1
0
        public void No_Tracking_Data_Available()
        {
            var td = new TrackingData();

            Expect.Call(_mockTracker.GetTrackingData("abc")).Return(null).Repeat.Twice();

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker);
            Assert.AreEqual(null, _ct.GetTrackingData("abc"));
            Assert.AreEqual(null, _ct.GetTrackingData("abc"));

            _mocks.VerifyAll();
        }
示例#2
0
        public void Simple_Cache_Check()
        {
            var td = new TrackingData();

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

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker, TimeSpan.FromSeconds(10.0));
            _ct.GetTrackingData("abc"); //This should use the passed in tracker
            _ct.GetTrackingData("abc"); //This should use the cache

            _mocks.VerifyAll();
        }
示例#3
0
        public void No_Tracking_Data_Available()
        {
            var td = new TrackingData();

            Expect.Call(_mockTracker.GetTrackingData("abc")).Return(null).Repeat.Twice();

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker);
            Assert.AreEqual(null, _ct.GetTrackingData("abc"));
            Assert.AreEqual(null, _ct.GetTrackingData("abc"));

            _mocks.VerifyAll();
        }
示例#4
0
        public void Try_Default_Cache_Time()
        {
            var td = new TrackingData();

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

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker);
            _ct.GetTrackingData("abc");             //This should use the passed in tracker
            _ct.GetTrackingData("abc");             //This should use the cache

            _mocks.VerifyAll();
        }
示例#5
0
        public void Simple_Cache_Check()
        {
            var td = new TrackingData();

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

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker, TimeSpan.FromSeconds(10.0));
            _ct.GetTrackingData("abc");             //This should use the passed in tracker
            _ct.GetTrackingData("abc");             //This should use the cache

            _mocks.VerifyAll();
        }
示例#6
0
        public void Cache_Expired_Recheck_Tracker()
        {
            var td = new TrackingData();

            Expect.Call(_mockTracker.GetTrackingData("abc")).Return(td).Repeat.Twice();

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker, TimeSpan.FromSeconds(1.0));
            _ct.GetTrackingData("abc"); //This should use the passed in tracker
            Thread.Sleep(2000);
            _ct.GetTrackingData("abc"); //This should use ask the pass in tracker again

            _mocks.VerifyAll();
        }
示例#7
0
        public void Cache_Expired_Recheck_Tracker()
        {
            var td = new TrackingData();

            Expect.Call(_mockTracker.GetTrackingData("abc")).Return(td).Repeat.Twice();

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker, TimeSpan.FromSeconds(1.0));
            _ct.GetTrackingData("abc");             //This should use the passed in tracker
            Thread.Sleep(2000);
            _ct.GetTrackingData("abc");             //This should use ask the pass in tracker again

            _mocks.VerifyAll();
        }
示例#8
0
        public void Try_Default_Cache_Time()
        {
            var td = new TrackingData();

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

            _mocks.ReplayAll();

            _ct = new CacheTracker(_mockTracker);
            _ct.GetTrackingData("abc"); //This should use the passed in tracker
            _ct.GetTrackingData("abc"); //This should use the cache

            _mocks.VerifyAll();
        }