public void Backup_FileCopiedAndDeleted_DestCopied(bool backupExists, bool ignoreMetadataErrors)
{
string srcPath = GetTestFilePath();
string destPath = GetTestFilePath();
string destBackupPath = GetTestFilePath();
byte[] srcContents = new byte[] { 1, 2, 3, 4, 5 };
File.WriteAllBytes(srcPath, srcContents);
byte[] destContents = new byte[] { 6, 7, 8, 9, 10 };
File.WriteAllBytes(destPath, destContents);
if (backupExists)
{
File.Create(destBackupPath).Dispose();
}
Replace(srcPath, destPath, destBackupPath, ignoreMetadataErrors);
Assert.False(File.Exists(srcPath));
Assert.Equal(srcContents, File.ReadAllBytes(destPath));
Assert.Equal(destContents, File.ReadAllBytes(destBackupPath));
}