示例#1
0
        public void DeleteFile_Not_Existing_Returns_True()
        {
            string fileNameCopied = "DeleteFile_Not_Existing_Returns_True.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

            Assert.IsFalse(File.Exists(_pathCopied));
            Assert.IsTrue(FileLibrary.DeleteFile(_pathCopied));
        }
示例#2
0
        public void DeleteFile_Existing_ReadOnly_Not_Overwritten_Does_Not_Delete_File_And_Returns_False()
        {
            string fileNameCopied = "DeleteFile_Existing_ReadOnly_Not_Overwritten_Does_Not_Delete_File_And_Returns_False.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

            FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false);
            Assert.IsTrue(File.Exists(_pathCopied));

            File.SetAttributes(_pathCopied, FileAttributes.ReadOnly);

            Assert.IsFalse(FileLibrary.DeleteFile(_pathCopied));
            Assert.IsTrue(File.Exists(_pathCopied));
        }
示例#3
0
        public void DeleteFile_Existing_Deletes_File_And_Returns_True()
        {
            //string fileNameCopied = "DeleteFile_Existing_Deletes_File_And_Returns_True.txt";
            string fileNameCopied = "DeleteFile_1.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

            FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: true);

            Assert.IsTrue(File.Exists(_pathCopied));

            Assert.IsTrue(FileLibrary.DeleteFile(_pathCopied));
            Assert.IsFalse(File.Exists(_pathCopied));
        }