Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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();
        }