public void BypassCacheForRecentResults()
        {
            // Setup the cache
            var cachedResults = new TwitterSearchResultCollection();
            cachedResults.Add(new TwitterSearchResult() { Id = 1, Text = "This is just a #test" });
            _localCache.Stub(c => c.PageResults).Return(cachedResults);
            _localCache.Stub(c => c.PageNumber).Return(1);

            // Setup the Twitterizer response
            TwitterResponse<TwitterSearchResultCollection> response = new TwitterResponse<TwitterSearchResultCollection>();
            response.ResponseObject = new TwitterSearchResultCollection();
            response.ResponseObject.Add(new TwitterSearchResult() { Id = 1, Text = "This is just a #test" });
            response.ResponseObject.Add(new TwitterSearchResult() { Id = 2, Text = "This is just another #test" });
            _searchService
                .Expect(s => s.Search(Arg<string>.Is.Anything, Arg<SearchOptions>.Is.Anything))
                .Return(response);

            TwitterSearchClient client = new TwitterSearchClient(_localCache, _searchService);
            var results = client.Search("#test", 1, 10, true); //newSearch means ignore the cache
            Assert.IsFalse(AreEquivalent(cachedResults, results));
            Assert.IsTrue(AreEquivalent(response.ResponseObject, results));

            _searchService.VerifyAllExpectations();
            _localCache.VerifyAllExpectations();
        }
        public void RetrieveTweetsFromCache()
        {
            var cachedResults = new TwitterSearchResultCollection();
            cachedResults.Add(new TwitterSearchResult() { Id = 1, Text = "This is just a #test" });

            _searchService.AssertWasNotCalled(s => s.Search(Arg<string>.Is.Anything, Arg<SearchOptions>.Is.Anything));

            _localCache.Expect(c => c.PageResults).Return(cachedResults);
            _localCache.Expect(c => c.PageNumber).Return(1);

            TwitterSearchClient client = new TwitterSearchClient(_localCache, _searchService);
            var results = client.Search("#test", 1, 10, false);
            Assert.IsTrue(AreEquivalent(cachedResults, results));

            _searchService.VerifyAllExpectations();
            _localCache.VerifyAllExpectations();
        }