private void TestAndAssertExpectationsAreMet(string xmlExpected, string commandLine)
        {
            SearchReplaceFileReplacer srMain = new SearchReplaceFileReplacer(TestHelper.GetApplicationParameters(commandLine));

            srMain.ProcessAll();

            string xmlActual = File.ReadAllText(_SrcFile);

            Assert.IsTrue(File.Exists(Utility.GetBackupFileName(_SrcFile)), "Backup file was not created.");
            Assert.AreEqual(xmlExpected, xmlActual);
        }
        public void ProcessAll_EnEvAnAv_ContinueOnError()
        {
            string commandLine = String.Format(@"/F={0} /O=en,ev,av,an /S=""Book"" /R=""LibraryBook"" /I /W /C", _SrcFile);

            File.SetAttributes(_SrcFile, FileAttributes.ReadOnly);

            SearchReplaceFileReplacer main = new SearchReplaceFileReplacer(TestHelper.GetApplicationParameters(commandLine));

            main.ProcessAll();

            Assert.IsTrue(File.Exists(Utility.GetBackupFileName(_SrcFile)));

            File.SetAttributes(_SrcFile, FileAttributes.Normal);
            File.SetAttributes(Utility.GetBackupFileName(_SrcFile), FileAttributes.Normal);
        }
        public void ProcessAll_EnEvAnAv_InvalidXmlFile()
        {
            string commandLine = String.Format(@"/F={0} /O=en,ev,av,an /S=""Book"" /R=""LibraryBook"" /I /W", _SrcFile);

            File.WriteAllText(_SrcFile, String.Empty);

            SearchReplaceFileReplacer main = new SearchReplaceFileReplacer(TestHelper.GetApplicationParameters(commandLine));

            try
            {
                main.ProcessAll();
            }
            catch
            {
                Assert.IsFalse(File.Exists(Utility.GetBackupFileName(_SrcFile)));
                return;
            }

            Assert.Fail();
        }