Exemplo n.º 1
0
        public void Initialize()
        {
            _clock = MockSystemClock.Get();
            _clock.SetDateTime(DateTime.Now);
            NoOpDiskTrimmableRegistry.Instance.ResetCounter();
            _diskTrimmableRegistry = NoOpDiskTrimmableRegistry.Instance;
            _cacheEventListener    = new DuplicatingCacheEventListener();

            // We know the directory will be this
            _cacheDirectory = new DirectoryInfo(
                Path.Combine(ApplicationData.Current.LocalCacheFolder.Path, CACHE_TYPE));
            _cacheDirectory.Create();
            if (!_cacheDirectory.Exists)
            {
                throw new Exception(
                          string.Format(
                              "Cannot create cache dir: {0}: directory {1}",
                              ApplicationData.Current.LocalCacheFolder.Path,
                              _cacheDirectory.Exists ? "already exists" : "does not exist"));
            }

            _storage = CreateDiskStorage(TESTCACHE_VERSION_START_OF_VERSIONING);
            _cache   = CreateDiskCache(_storage, false);
            Assert.IsTrue(((NoOpDiskTrimmableRegistry)_diskTrimmableRegistry).RegisterDiskTrimmableCount == 1);
        }
        public void Initialize()
        {
            _clock = MockSystemClock.Get();
            StorageFolder cacheDir = ApplicationData.Current.LocalCacheFolder;

            _directory = new DirectoryInfo(Path.Combine(cacheDir.Path, "sharded-disk-storage-test"));
            Assert.IsTrue(_directory.CreateEmpty());
            FileTree.DeleteContents(_directory);
            _clock.SetDateTime(DateTime.Now);
        }