public void ShouldDeleteOverwrittenFileOnBeginComit() { String overwrittenFilePath = null; FileMovePlugin plugin = null; try { overwrittenFilePath = Path.GetTempFileName(); plugin = new FileMovePlugin(); plugin.CommitFailed += delegate(object sender, ObjectErrorEventArgs<IPlugin> e) { throw e.Exception; }; plugin.ShouldOwerwriteExistingFile = true; plugin.TemporaryFilePath = overwrittenFilePath; plugin.BeginCommit(); Assert.IsFalse(File.Exists(overwrittenFilePath)); } finally { if (File.Exists(overwrittenFilePath)) File.Delete(overwrittenFilePath); } }
public void ShouldFailWithFileNotFoundExceptionWhenOverwritedTemporaryFilePathDoesNotExistOnBeginComit() { var overwritedTemporaryFilePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); var plugin = new FileMovePlugin(); plugin.ShouldOwerwriteExistingFile = true; plugin.TemporaryFilePath = overwritedTemporaryFilePath; plugin.CommitFailed += delegate(object sender, ObjectErrorEventArgs<IPlugin> e) { throw e.Exception; }; plugin.BeginCommit(); }