public void TestEnumAttributes() { XmlElement element = xmlDocument.CreateElement("element"); // Test attribute writing. LacingStrategy strategy = LacingStrategy.CrossProduct; XmlElementHelper writer = new XmlElementHelper(element); writer.SetAttribute("ValidName", strategy.ToString()); writer.SetAttribute("ValidName2", "UnknownEnumString"); // Test reading of existing attributes (with valid/invalid values). XmlElementHelper reader = new XmlElementHelper(element); Assert.AreEqual(strategy, reader.ReadEnum("ValidName", LacingStrategy.Disabled)); LacingStrategy defaultValue = LacingStrategy.First; Assert.AreEqual(defaultValue, reader.ReadEnum("ValidName2", defaultValue)); }