public void LoadListUnsorted_with_caching_disabled_expect_object_to_be_retrieved()
        {
            _config.EnableCaching = false;

            var storageHelper = MockRepository.GenerateStub<IStorageHelper<FakeObject>>();
            storageHelper.Stub(h => h.GetCollection()).Return(FakeObject.UnsortedList);

            var cacheHelper = MockRepository.GenerateStub<ICacheHelper<FakeObject>>();

            var repo = new BaseRepository<FakeObject>(_config) { StorageHelper = storageHelper, CacheHelper = cacheHelper };

            var result = repo.LoadListUnsorted();

            storageHelper.AssertWasCalled(h => h.GetCollection());
        }
        public void LoadListUnsorted_with_caching_enabled_expect_StorageHelper_not_called()
        {
            _config.EnableCaching = true;

            var storageHelper = MockRepository.GenerateStub<IStorageHelper<FakeObject>>();

            var cacheHelper = MockRepository.GenerateStub<ICacheHelper<FakeObject>>();
            cacheHelper.Stub(c => c.GetCollection()).Return(FakeObject.UnsortedList);

            var repo = new BaseRepository<FakeObject>(_config) { StorageHelper = storageHelper, CacheHelper = cacheHelper };

            var result = repo.LoadListUnsorted();

            storageHelper.AssertWasNotCalled(h => h.GetCollection());
        }
        public void Load_with_caching_enabled_object_not_in_cache_expect_object_to_be_retrieved()
        {
            _config.EnableCaching = true;

            var storageHelper = MockRepository.GenerateStub<IStorageHelper<FakeObject>>();
            storageHelper.Stub(h => h.GetCollection()).Return(FakeObject.UnsortedList);

            var cacheHelper = MockRepository.GenerateStub<ICacheHelper<FakeObject>>();
            cacheHelper.Stub(c => c.GetObject(FakeObject.InstanceIdentifier)).Return(null);

            var repo = new BaseRepository<FakeObject>(_config) { StorageHelper = storageHelper, CacheHelper = cacheHelper };

            var result = repo.LoadListUnsorted();

            storageHelper.AssertWasCalled(h => h.GetCollection());
        }