public void Constructs_ok() { var attribute1 = new Gallio.Common.Xml.NodeAttribute(123, "name1", "value1", 999); var attribute2 = new Gallio.Common.Xml.NodeAttribute(456, "name2", "value2", 999); var attribute3 = new Gallio.Common.Xml.NodeAttribute(789, "name3", "value3", 999); var array = new[] { attribute1, attribute2, attribute3 }; var collection = new NodeAttributeCollection(array); Assert.Count(3, collection); Assert.AreElementsSame(array, collection); }
public void Constructs_non_empty_element() { var attribute1 = new Gallio.Common.Xml.NodeAttribute(0, "diameter", "4878 km", 2); var attribute2 = new Gallio.Common.Xml.NodeAttribute(1, "revolution", "58.6 d", 2); var mockChild1 = MockRepository.GenerateStub<INode>(); var mockChild2 = MockRepository.GenerateStub<INode>(); var element = new NodeElement(0, 123, "Planet", new[] { attribute1, attribute2 }, new[] { mockChild1, mockChild2 }); Assert.AreElementsSame(new[] { mockChild1, mockChild2 }, element.Children); Assert.AreElementsSame(new[] { attribute1, attribute2 }, element.Attributes); Assert.AreEqual("Planet", element.Name); }
public void Constructs_non_empty_element() { var attribute1 = new Gallio.Common.Xml.NodeAttribute(0, "diameter", "4878 km", 2); var attribute2 = new Gallio.Common.Xml.NodeAttribute(1, "revolution", "58.6 d", 2); var mockChild1 = MockRepository.GenerateStub <INode>(); var mockChild2 = MockRepository.GenerateStub <INode>(); var element = new NodeElement(0, 123, "Planet", new[] { attribute1, attribute2 }, new[] { mockChild1, mockChild2 }); Assert.AreElementsSame(new[] { mockChild1, mockChild2 }, element.Children); Assert.AreElementsSame(new[] { attribute1, attribute2 }, element.Attributes); Assert.AreEqual("Planet", element.Name); }