public void OuterClassWithArrayOfSerializableNoCtorToXml()
        {
            var serializable = new OuterClassWithArrayOfSerializableNoCtor()
            {
                SimpleOuterProperty = "Simple outer",
            };

            serializable.InnerObjects = new InnerClassNoCtor[2];

            serializable.InnerObjects[0] = InnerClassNoCtor.Create();
            serializable.InnerObjects[0].SimpleInnerProperty = "first";

            serializable.InnerObjects[1] = InnerClassNoCtor.Create();
            serializable.InnerObjects[1].SimpleInnerProperty = "second";

            var xml = serializable.ToXml();

            var doc = XDocument.Parse(xml);

            var elementSimpleOuter = doc.XPathSelectElement("/OuterClassWithArrayOfSerializableNoCtor/SimpleOuterProperty");

            Assert.AreEqual("Simple outer", elementSimpleOuter.Value);

            var elementsInner = doc.XPathSelectElements("/OuterClassWithArrayOfSerializableNoCtor/InnerObjects/InnerClassNoCtor/SimpleInnerProperty").ToArray();

            Assert.AreEqual("first", elementsInner[0].Value);
            Assert.AreEqual("second", elementsInner[1].Value);
        }
        public void TestOuterFieldNoCtorToXml()
        {
            var inner = InnerClassNoCtor.Create();

            inner.SimpleInnerProperty = "Simple inner";

            var serializable = new OuterClassNoCtor()
            {
                SimpleOuterProperty = "Simple outer",
                ObjectProperty      = inner
            };

            var xml = serializable.ToXml();

            var doc = XDocument.Parse(xml);

            var elementSimpleOuter = doc.XPathSelectElement("/OuterClassNoCtor/SimpleOuterProperty");

            Assert.AreEqual("Simple outer", elementSimpleOuter.Value);

            var elementSimpleInner = doc.XPathSelectElement("/OuterClassNoCtor/ObjectProperty/InnerClassNoCtor/SimpleInnerProperty");

            Assert.AreEqual("Simple inner", elementSimpleInner.Value);
        }