public XmlNodeSimplified Build(XmlNode node)
        {
            var result = new XmlNodeSimplified
            {
                Name       = node.Name,
                Attributes = GetAttributes(node).ToArray(),
                Children   = node.ChildNodes.Cast <XmlNode>().Select(Build).ToArray(),
                NodeType   = node.NodeType,
                InnerText  = node.InnerText
            };

            return(result);
        }
Esempio n. 2
0
        public void BeEqualTo(XmlNodeSimplified expected)
        {
            BeEqualShallowTo(expected);
            _childrenNumberCheck.AssertChildrenNumber(expected);

            var childrenActual   = _assertContext.XmlNode.Children.ToList();
            var childrenExpected = expected.Children.ToList();

            for (var i = 0; i < childrenActual.Count; i++)
            {
                var childAssertable = CreateChildAssertable(childrenActual, i);
                childAssertable.BeEqualTo(childrenExpected[i]);
            }
        }
Esempio n. 3
0
        public AssertContext BuildChildContext(XmlNodeSimplified childNode, int childNodeIndex)
        {
            var childPath = MyPath.Append(childNode.Name, childNodeIndex);

            return(new AssertContext(childPath, childNode, StringComparer));
        }
Esempio n. 4
0
 public AssertContext(XmlPath myPath, XmlNodeSimplified xmlNode, StringComparer stringComparer)
 {
     MyPath         = myPath;
     XmlNode        = xmlNode;
     StringComparer = stringComparer;
 }
 public AssertContext Build(XmlPath path, XmlNodeSimplified node)
 {
     return(new AssertContext(path, node, _stringComparer));
 }
Esempio n. 6
0
 private void BeEqualShallowTo(XmlNodeSimplified expected)
 {
     _nameCheck.AssertName(expected.Name);
     _attributeCheck.AssertAttributesCollection(expected.Attributes);
     _textCheck.AssertText(expected);
 }