public static void NullXNameTestAttributes() { XDocument xDoc = TestData.GetDocumentWithContacts(); IEnumerable <XAttribute> xAttrib = xDoc.Root.Attributes(null); Assert.Equal(0, xAttrib.Count()); }
public static void InvalidXNameTest() { Assert.Throws <XmlException>(() => { TestData.GetDocumentWithContacts().Root.Attribute("*&^%_#@!"); }); Assert.Throws <ArgumentException>(() => { TestData.GetDocumentWithContacts().Root.Attribute(""); }); Assert.Throws <XmlException>(() => { TestData.GetDocumentWithContacts().Root.Attributes("*&^%_#@!"); }); Assert.Throws <ArgumentException>(() => { TestData.GetDocumentWithContacts().Root.Attributes(""); }); }
public static void NullXNameTestAttribute() { XDocument xDoc = TestData.GetDocumentWithContacts(); XAttribute xAttrib = xDoc.Root.Attribute(null); Assert.Null(xAttrib); }
public static void NullXNameTestElement() { XDocument xDoc = TestData.GetDocumentWithContacts(); XElement xElement = xDoc.Root.Element(null); Assert.Null(xElement); }
public static void IEnumerableInDocumentOrderVariationTwo() { XDocument xDoc = TestData.GetDocumentWithContacts(); IEnumerable <XElement> xElement = xDoc.Root.DescendantsAndSelf().Reverse(); Assert.True(xElement.InDocumentOrder().EqualsAll(xDoc.Root.DescendantsAndSelf(), XNode.DeepEquals)); }
public static void NullXNameTestElements() { XDocument xDoc = TestData.GetDocumentWithContacts(); XElement xElement = xDoc.Root.Element(null); IEnumerable <XNode> xNodeList = xDoc.Root.Elements(null); Assert.Equal(0, xNodeList.Count()); }
public static void ReorderToDocumentOrder() { XDocument xDoc = TestData.GetDocumentWithContacts(); Random rnd = new Random(); var randomOrderedElements = xDoc.Root.DescendantNodesAndSelf().OrderBy(n => rnd.Next(0, int.MaxValue)); using (var en = randomOrderedElements.InDocumentOrder().GetEnumerator()) { en.MoveNext(); var nodeFirst = en.Current; while (en.MoveNext()) { var nodeSecond = en.Current; Assert.True(XNode.DocumentOrderComparer.Compare(nodeFirst, nodeSecond) < 0); nodeFirst = nodeSecond; } } }
public static void NullXNameTest() { XDocument xDoc = TestData.GetDocumentWithContacts(); Assert.Equal(0, xDoc.Root.Elements().Attributes(null).Count()); }