public void Copy_Replacing_Old_File() { /* seed both source and target */ _pwans.MoveToSource("an", "bn"); _pwans.MoveToTarget("ao"); _action.Act(); /* both files has been replaced*/ Assert.AreEqual(true, _pwans.TargetIs("an", "bn")); Assert.AreEqual(false, _pwans.TargetIs("ao", "bn")); }
public void File_Locked_Unlocked() { _dummies.MoveToTarget("fn"); string filePath = ""; /* non existing file is not locked */ filePath = ConstantsPR.TestTargetPath + @"\" + "nonexistinf.file"; Assert.AreEqual(false, FileHelpers.IsFileLocked(filePath)); /* non running file is not locked */ filePath = ConstantsPR.TestTargetPath + @"\" + "f.exe"; FileHelpers.SetFileNotReadonly(new FileInfo(filePath)); Assert.AreEqual(false, FileHelpers.IsFileLocked(filePath)); /* running file is locked */ Process process = FileHelpers.ExecuteCommand(filePath, ""); Assert.AreEqual(true, FileHelpers.IsFileLocked(filePath)); /* closing running process */ Thread.Sleep(1000); process.CloseMainWindow(); process.Close(); /* non running file is not locked */ Thread.Sleep(1000); Assert.AreEqual(false, FileHelpers.IsFileLocked(filePath)); }
public void TestMoveMethods() { _dummies.MoveToSource("ao", "bn"); _dummies.MoveToTarget("an", "en"); _dummies.TargetIs("an", "dn"); // empty directory get filled // single file get overridden (with read only flag) // new file stays // exception on the file that absent in source // exception on the file that is locked in destination }