Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/XmlAdapter.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/XmlAdapter.cs (.../XmlAdapter.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/XmlAdapter.cs (.../XmlAdapter.cs) (revision 4052) @@ -21,27 +21,26 @@ using System.Text.RegularExpressions; -namespace Deltares.DamEngine.TestHelpers +namespace Deltares.DamEngine.TestHelpers; + +/// +/// Helper class for adapting xml in tests +/// +public class XmlAdapter { /// - /// Helper class for adapting xml in tests + /// Changes in an XML the value of all elements with the specified key to the specified value. /// - public class XmlAdapter + /// The input. + /// The key. + /// The value. + /// + public static string ChangeValueInXml(string input, string key, string value) { - /// - /// Changes in an XML the value of all elements with the specified key to the specified value. - /// - /// The input. - /// The key. - /// The value. - /// - public static string ChangeValueInXml(string input, string key, string value) - { - string result = input; - string searchString = key + "=" + "\"([^\"]*)\""; // This means match any pattern which matches ="" - string replacement = key + "=\"" + value + "\""; // Replace with ="" - result = Regex.Replace(input, searchString, replacement, RegexOptions.IgnorePatternWhitespace); - return result; - } + string result = input; + string searchString = key + "=" + "\"([^\"]*)\""; // This means match any pattern which matches ="" + string replacement = key + "=\"" + value + "\""; // Replace with ="" + result = Regex.Replace(input, searchString, replacement, RegexOptions.IgnorePatternWhitespace); + return result; } } \ No newline at end of file