예제 #1
0
 public void TearDown()
 {
     CommandRunner.DeleteFile(Environment.CurrentDirectory + @"\TransferConfig.xml");
     SqlCommandRunner.DeleteDb(_Db1);
     SqlCommandRunner.DeleteDb(_Db2);
     CommandRunner.CleanUpDirectory(_TestTempDirectory);
 }
예제 #2
0
        public void Test3()
        {
            string targetName = string.Format("{0}{1}.bak", DiskOperations.CorrectDirectory(_TestTempDirectory), _TempDbName);

            SqlCommandRunner.BackUpDb(_TempDbName, targetName);
            Assert.IsTrue(File.Exists(targetName));
            CommandRunner.DeleteFile(targetName);
        }
예제 #3
0
 private void TryClean()
 {
     try
     {
         CommandRunner.DeleteFile(Session["UploadTarget"].ToString());
         Session["UploadTarget"] = string.Empty;
     }
     catch (ApplicationException)
     {
     }
 }
예제 #4
0
        public void Test2()
        {
            const string fileName          = "testFile.txt";
            const string tempDirectoryName = "Temps";

            string completeDir = DiskOperations.CorrectDirectory(_TestTempDirectory) + tempDirectoryName + "\\";

            DiskOperations.CheckAndCreateDirectory(completeDir);

            //先构建一个文件
            StreamWriter sw = new StreamWriter(_TestTempDirectory + fileName, false);

            sw.Write("测试文件,随意删除,不过见到此文件就说明垃圾清理工作没有做好-_-!");
            sw.Close();
            //拷贝
            CommandRunner.CopyToDirectory(_TestTempDirectory + fileName, completeDir);
            Assert.IsTrue(File.Exists(completeDir + fileName));
            //清理
            CommandRunner.CleanUpDirectory(_TestTempDirectory);
            CommandRunner.DeleteFile(completeDir + fileName);
            Assert.IsTrue(!File.Exists(completeDir + fileName));
        }