private bool CopyToReadOnlyFile(FileCopier copier) { if (File.Exists(ReadOnlyDestTxtPath)) { FileInfo info = new FileInfo(ReadOnlyDestTxtPath); // ensure that the file is readonly. if (!info.IsReadOnly) { info.IsReadOnly = true; } return copier.TryCopyFile(SrcFilePath, ReadOnlyDestTxtPath); } else { Assert.Fail("The data for this test case has not been properly deployed! Missing file: " + ReadOnlyDestTxtPath); return false; } }
private bool CopyToNonExistantDirectory(FileCopier copier) { string destPath = Path.Combine(TargetDestDir, @"newdir\another\out.txt"); return copier.TryCopyFile(SrcFilePath, destPath); }
private bool CopyToExistingFile(FileCopier copier) { if (File.Exists(ExistingDestTxtPath)) { return copier.TryCopyFile(SrcFilePath, ExistingDestTxtPath); } else { Assert.Fail("The data for this test case has not been properly deployed! Missing file: " + ExistingDestTxtPath); return false; } }
private bool CopyToDirectory(FileCopier copier) { return copier.TryCopyFile(SrcFilePath, TargetDestDir); }
private bool CopyFileToNamedTarget(FileCopier copier) { string destPath = Path.Combine(TargetDestDir, @"out.txt"); return copier.TryCopyFile(SrcFilePath, destPath); }
public void TryCopyFile_SourceDir() { var target = new FileCopier(); target.TryCopyFile(TargetDestDir, TargetDestDir); }