예제 #1
0
        public void CacheFile_InCache()
        {
            string outFileName = Path.GetTempFileName();
            string srcFileName = Path.GetTempFileName();

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

                CreateTempFile(srcFileName);
                string handle = m_mgr.GetHash(srcFileName);

                m_mgr.CacheFile(handle, outFileName);
                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
            {
                File.Delete(outFileName);
                File.Delete(srcFileName);
            }
        }