Esempio n. 1
0
        void VerifyLists()
        {
            var serializer = new ConfigurationContainer().EnableXmlText()
                             .Create()
                             .ForTesting();

            var instance = new ClassWithMixedContent {
                Value = new List <object> {
                    123, 345
                }
            };

            serializer.Cycle(instance)
            .ShouldBeEquivalentTo(instance);

            var second = new ClassWithMixedContent {
                Value = new List <object> {
                    123, "hello world?", 345
                }
            };
            var content = serializer.Cycle(second);

            content.ShouldBeEquivalentTo(second);
            content.Value.Should()
            .HaveCount(3);
            content.Value.Should()
            .Contain("hello world?");
        }
Esempio n. 2
0
        void VerifyLists()
        {
            var serializer = new ConfigurationContainer().EnableXmlText()
                             .Create()
                             .ForTesting();

            var instance = new ClassWithMixedContent {
                Value = new List <object> {
                    123, 345
                }
            };

            serializer.Assert(instance,
                              @"<?xml version=""1.0"" encoding=""utf-8""?><Issue192Tests-ClassWithMixedContent xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ReportedIssues;assembly=ExtendedXmlSerializer.Tests.ReportedIssues""><int xmlns=""https://extendedxmlserializer.github.io/system"">123</int><int xmlns=""https://extendedxmlserializer.github.io/system"">345</int></Issue192Tests-ClassWithMixedContent>");

            serializer.Cycle(instance)
            .Should().BeEquivalentTo(instance);

            var second = new ClassWithMixedContent {
                Value = new List <object> {
                    123, "hello world?", 345
                }
            };
            var content = serializer.Cycle(second);

            content.Should().BeEquivalentTo(second);
            content.Value.Should()
            .HaveCount(3);
            content.Value.Should()
            .Contain("hello world?");
        }