Library/Library.Test/TestHtmlParser.cs
C# | Copy Code |
---|---|
IEnumerator<XmlLightAttribute> en; en = XmlLightParser.ParseAttributes("<tag a=\"1\" b='2' c=3 d e=>").GetEnumerator(); Assert.IsTrue(en.MoveNext()); Assert.AreEqual("a", en.Current.Name); Assert.AreEqual("1", en.Current.Value); Assert.IsTrue(en.MoveNext()); Assert.AreEqual("b", en.Current.Name); Assert.AreEqual("2", en.Current.Value); Assert.IsTrue(en.MoveNext()); Assert.AreEqual("c", en.Current.Name); Assert.AreEqual("3", en.Current.Value); Assert.IsTrue(en.MoveNext()); Assert.AreEqual("d", en.Current.Name); Assert.AreEqual(null, en.Current.Value); Assert.IsTrue(en.MoveNext()); Assert.AreEqual("e", en.Current.Name); Assert.AreEqual("", en.Current.Value); Assert.IsFalse(en.MoveNext()); en = XmlLightParser.ParseAttributes("<?xml version='1.0'?>").GetEnumerator(); Assert.IsTrue(en.MoveNext()); Assert.AreEqual("version", en.Current.Name); Assert.AreEqual("1.0", en.Current.Value); Assert.IsFalse(en.MoveNext()); |
VB.NET | Copy Code |
---|---|
Dim en As IEnumerator(Of XmlLightAttribute) en = XmlLightParser.ParseAttributes("<tag a=""1"" b='2' c=3 d e=>").GetEnumerator() Assert.IsTrue(en.MoveNext()) Assert.AreEqual("a", en.Current.Name) Assert.AreEqual("1", en.Current.Value) Assert.IsTrue(en.MoveNext()) Assert.AreEqual("b", en.Current.Name) Assert.AreEqual("2", en.Current.Value) Assert.IsTrue(en.MoveNext()) Assert.AreEqual("c", en.Current.Name) Assert.AreEqual("3", en.Current.Value) Assert.IsTrue(en.MoveNext()) Assert.AreEqual("d", en.Current.Name) Assert.AreEqual(Nothing, en.Current.Value) Assert.IsTrue(en.MoveNext()) Assert.AreEqual("e", en.Current.Name) Assert.AreEqual("", en.Current.Value) Assert.IsFalse(en.MoveNext()) en = XmlLightParser.ParseAttributes("<?xml version='1.0'?>").GetEnumerator() Assert.IsTrue(en.MoveNext()) Assert.AreEqual("version", en.Current.Name) Assert.AreEqual("1.0", en.Current.Value) Assert.IsFalse(en.MoveNext()) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7