internal static void RemoveAttribute(ref XmlDocument document, Attribute attribute)
 {
     XmlNodeList parentNodes = document.SelectNodes(attribute.ParentElementXPath);
     if (parentNodes != null)
     {
         foreach (XmlNode parentNode in parentNodes)
         {
             if (parentNode.Attributes != null) parentNode.Attributes.RemoveNamedItem(attribute.Name);
         }
     }
 }
 public void AttributesToExcludeProperty()
 {
     var testValue = new List<Attribute>();
     var testAttribute = new Attribute();
     testAttribute.Name = "name";
     testAttribute.ParentElementXPath = "xpath";
     testValue.Add(testAttribute);
     var testInstance = new BizUnitXmlCompareConfiguration();
     testInstance.AttributesToExclude = testValue;
     Assert.AreEqual("name", testInstance.AttributesToExclude[0].Name);
     Assert.AreEqual("xpath", testInstance.AttributesToExclude[0].ParentElementXPath);
 }
 private static List<Attribute> ParseAttributeExclusions(XmlNode testConfig)
 {
     var attributesToExclude = new List<Attribute>();
     XmlNodeList configuredAttributesToExclude = testConfig.SelectNodes("Exclusions/Attribute/ParentElement");
     if (configuredAttributesToExclude != null)
     {
         foreach (XmlNode attributeExclude in configuredAttributesToExclude)
         {
             var attribute = new Attribute();
             attribute.ParentElementXPath = attributeExclude.InnerText;
             if (attributeExclude.NextSibling != null) attribute.Name = attributeExclude.NextSibling.InnerText;
             attributesToExclude.Add(attribute);
         }
     }
     return attributesToExclude;
 }