Beispiel #1
0
        public void CanSerializeArrayAsProperty()
        {
            var container = new ContainerWithArrayProperty
            {
                Information = new[]
                {
                    new DataPoint
                    {
                        Name       = "FooBar",
                        Preference = new Preference
                        {
                            Id = 123
                        }
                    }
                }
            };

            var serializer = new XmlSerializer <ContainerWithArrayProperty>(options => options.Indent(), typeof(Preference));

            var xml = serializer.Serialize(container);

            Assert.That(xml, Contains.Substring(@"xsi:type=""Preference"""));
            Assert.IsTrue(xml.IndexOf(@"xsi:type=""Preference""") == xml.LastIndexOf(@"xsi:type=""Preference"""));
        }
Beispiel #2
0
        public void CanSerializeArrayAsProperty()
        {
            var container = new ContainerWithArrayProperty
            {
                Information = new[]
                {
                    new DataPoint
                    {
                        Name = "FooBar",
                        Preference = new Preference
                        {
                            Id = 123
                        }
                    }
                }
            };

            var serializer = new XmlSerializer<ContainerWithArrayProperty>(options => options.Indent(), typeof(Preference));

            var xml = serializer.Serialize(container);

            Assert.That(xml, Contains.Substring(@"xsi:type=""Preference"""));
            Assert.IsTrue(xml.IndexOf(@"xsi:type=""Preference""") == xml.LastIndexOf(@"xsi:type=""Preference"""));
        }