System.IO.Tests.File_Replace_str_str_str.Backup_FileCopiedAndDeleted_DestCopied C# (CSharp) Method

Backup_FileCopiedAndDeleted_DestCopied() private method

private Backup_FileCopiedAndDeleted_DestCopied ( bool backupExists, bool ignoreMetadataErrors ) : void
backupExists bool
ignoreMetadataErrors bool
return void
        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));
        }