Beispiel #1
0
        public void Persistence()
        {
            string outFileName = Path.GetTempFileName();
            string srcFileName = Path.GetTempFileName();

            bool fNeedToDelete = true;

            try
            {
                CreateTempFile(outFileName);
                string outHash = m_mgr.GetHash(outFileName);

                CreateTempFile(srcFileName);
                string handle = "p_jXrLgQMK7dUx+QMtYfjw==.0";                 // m_mgr.GetHash(srcFileName);

                m_mgr.CacheFile(handle, outFileName);
                m_mgr.Close();
                File.Delete(outFileName);
                fNeedToDelete = false;

                m_mgr = new LocalCacheManager();
                CachedFile[] resFileName = m_mgr.GetCachedFiles(handle);

                Assert.AreEqual(1, resFileName.Length);
                Assert.AreEqual(outHash, m_mgr.GetHash(resFileName[0].CachedFileName));
                Assert.AreEqual(Path.GetFileName(outFileName), resFileName[0].OriginalName);
            }
            finally
            {
                if (fNeedToDelete)
                {
                    File.Delete(outFileName);
                }
                File.Delete(srcFileName);
            }
        }
Beispiel #2
0
		public void FixtureSetup()
		{
			m_mgr = new LocalCacheManager(Path.Combine(Path.GetTempPath(), "FileCache"));
		}
Beispiel #3
0
		public void Persistence()
		{
			string outFileName = Path.GetTempFileName();
			string srcFileName = Path.GetTempFileName();

			bool fNeedToDelete = true;
			try
			{
				CreateTempFile(outFileName);
				string outHash = m_mgr.GetHash(outFileName);

				CreateTempFile(srcFileName);
				string handle = "p_jXrLgQMK7dUx+QMtYfjw==.0"; // m_mgr.GetHash(srcFileName);

				m_mgr.CacheFile(handle, outFileName);
				m_mgr.Close();
				File.Delete(outFileName);
				fNeedToDelete = false;

				m_mgr = new LocalCacheManager();
				CachedFile[] resFileName = m_mgr.GetCachedFiles(handle);

				Assert.AreEqual(1, resFileName.Length);
				Assert.AreEqual(outHash, m_mgr.GetHash(resFileName[0].CachedFileName));
				Assert.AreEqual(Path.GetFileName(outFileName), resFileName[0].OriginalName);
			}
			finally
			{
				if (fNeedToDelete)
					File.Delete(outFileName);
				File.Delete(srcFileName);
			}
		}
Beispiel #4
0
 public void FixtureSetup()
 {
     m_mgr = new LocalCacheManager(Path.Combine(Path.GetTempPath(), "FileCache"));
 }