public void Test_CopyfFile_No_OverWrite()
        {
            var storeName = Guid.NewGuid().ToString();
            var storePath = Path.Combine(baseDirectory, storeName);
            var storage   = new DiskIsolateStorage(storeName, storePath);

            storage.InitStore();

            string sourceFileName      = "a.txt";
            string destinationFileName = "b.txt";

            string sourcePath      = Path.Combine(storePath, sourceFileName);
            string destinationPath = Path.Combine(storePath, destinationFileName);

            //创建一个源文件
            if (File.Exists(sourcePath))
            {
                File.Delete(sourcePath);
            }
            using (FileStream fs = new FileStream(sourcePath, FileMode.CreateNew))
            {
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    sw.Write("This is a.text");
                }
            }

            if (File.Exists(destinationPath))
            {
                File.Delete(destinationPath);
            }
            storage.CopyFile(sourceFileName, destinationFileName);

            Assert.IsTrue(File.Exists(destinationPath));
        }
        public void Test_CopyFile_OverWrite()
        {
            var storage = new DiskIsolateStorage("Test", baseDirectory);

            storage.InitStore();
            string storePath = Path.Combine(baseDirectory, "Test");

            string sourceFileName      = "a.txt";
            string destinationFileName = "b.txt";

            string sourcePath      = Path.Combine(storePath, sourceFileName);
            string destinationPath = Path.Combine(storePath, destinationFileName);

            //创建一个源文件
            if (File.Exists(sourcePath))
            {
                File.Delete(sourcePath);
            }
            FileStream   fs = new FileStream(sourcePath, FileMode.CreateNew);
            StreamWriter sw = new StreamWriter(fs);

            sw.Write("This is a.text");
            sw.Close();
            fs.Close();

            //创建一个已存在的目标文件
            if (File.Exists(destinationPath))
            {
                File.Delete(destinationPath);
            }
            FileStream   fs1 = new FileStream(destinationPath, FileMode.CreateNew);
            StreamWriter sw1 = new StreamWriter(fs1);

            sw1.Write("This is b.text");
            sw1.Close();
            fs1.Close();


            if (File.Exists(destinationPath))
            {
                storage.CopyFile(sourceFileName, destinationFileName, true);
            }

            //判断目标文件是否被重写
            bool isTrue = false;

            foreach (string line in File.ReadLines(destinationPath))
            {
                if (line.Contains("This is a.text"))
                {
                    isTrue = true;
                }
            }

            Assert.IsTrue(isTrue);
        }