Beispiel #1
0
        public void WrongCacheFilePathTest()
        {
            ComponentsLibraryCacheHelper_Accessor.s_defaultCacheLocation = "c:\\ComponentsLibrary.cache";

            ComponentsLibraryCache cache = ComponentsLibraryCacheHelper.LoadCacheFile();

            Assert.IsNull(cache);

            ComponentsLibraryCacheHelper_Accessor.s_defaultCacheLocation = null;

            cache = ComponentsLibraryCacheHelper.LoadCacheFile();

            Assert.IsNull(cache);
        }
Beispiel #2
0
        public void FileCacheHelperTest()
        {
            string cachePath = System.IO.Path.Combine(AppContext.BaseTestDirectory, "ComponentsLibrary.cache");

            ComponentsLibraryCacheHelper_Accessor.s_defaultCacheLocation = cachePath;
            ComponentsLibraryCache cache = ComponentsLibraryCacheHelper.LoadCacheFile();

            Assert.IsNull(cache);

            cache = new ComponentsLibraryCache(cachePath);

            Assert.IsTrue(cache.ComponentFiles != null);
            Assert.AreEqual(cache.AppExecutable, System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);

            ComponentsLibraryCacheHelper.StoreCacheFile(cache);

            Assert.IsFalse(cache.WasModified);
            Assert.IsTrue(ComponentsLibraryCacheHelper.CacheFileExists());

            ComponentsLibraryCacheHelper.DeleteCacheFile();

            Assert.IsFalse(ComponentsLibraryCacheHelper.CacheFileExists());
        }