public void Correctly_returns_null_when_cached_instance_is_not_found()
        {
            MockRepository mocks      = new MockRepository();
            IWebContext    webContext = mocks.CreateMock <IWebContext>();

            using (mocks.Record())
            {
                Expect.Call(webContext.GetItem <ApplicationInstance>(ApplicationInstance.CacheKey)).Return(null);
                Expect.Call(webContext.GetCacheItem <ApplicationInstance>(ApplicationInstance.CacheKey)).Return(null);
            }

            using (mocks.Playback())
            {
                IApplicationInstanceCache cache = new ApplicationInstanceCache(webContext, null);
                Assert.That(cache.GetCurrent(), Is.Null);
            }
        }
        public void Correctly_retrieves_application_instance_from_first_level_cache()
        {
            ApplicationInstance instance = new ApplicationInstance();

            MockRepository mocks      = new MockRepository();
            IWebContext    webContext = mocks.CreateMock <IWebContext>();

            using (mocks.Record())
            {
                Expect.Call(webContext.GetItem <ApplicationInstance>(ApplicationInstance.CacheKey)).Return(instance);
            }

            using (mocks.Playback())
            {
                IApplicationInstanceCache cache = new ApplicationInstanceCache(webContext, null);
                Assert.That(cache.GetCurrent(), Is.SameAs(instance));
            }
        }