示例#1
0
        public void OneDeepObjectForExtension()
        {
            var testClass = new TestExtensionClass();

            var generator = new XmlGenerator(
                CollectionUtils.Empty <IInterfaceXElements>(),
                new[] { new ObjectXElement <TestClass>("TestClass") },
                CollectionUtils.Empty <IGroupXElement>());

            var expected = new XElement("TestClass");
            var actual   = generator.CreateForObject(testClass);

            Assert.IsTrue(XNode.DeepEquals(expected, actual));
        }
示例#2
0
        public void TwoDeepGroupObjectForExtension()
        {
            var testClass = new TestContainer(true, new[] { new TestExtensionClass() });

            var generator = new XmlGenerator(
                CollectionUtils.Empty <IInterfaceXElements>(),
                new IObjectXElement[] { new ObjectXElement <TestClass>("TestClass"), new ObjectXElement <TestContainer>("TestContainer") },
                new[] { new GroupXElement <TestClass>("TestClasses") });

            var expected = new XElement("TestContainer", new XElement("TestClasses", new XElement("TestClass")));

            var actual = generator.CreateForObject(testClass);

            Assert.IsTrue(XNode.DeepEquals(expected, actual));
        }