public void PropertyInterfaceOfList()
        {
            var expected = new ClassWithPropertyInterfaceOfList
            {
                List = new List <string> {
                    "Item1"
                },
                Set = new HashSet <string> {
                    "Item2"
                },
                Dictionary = new Dictionary <string, string> {
                    { "Key", "Value" }
                }
            };

            const string ns =
#if CORE
                "Collections";
#else
                "Core";
#endif

            var actual =
                new SerializationSupport(new ConfigurationContainer()).Assert(expected,
                                                                              $"<?xml version=\"1.0\" encoding=\"utf-8\"?><ExtendedXmlSerializerTests-ClassWithPropertyInterfaceOfList xmlns=\"clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Xml;assembly=ExtendedXmlSerializer.Tests\"><List xmlns:sys=\"https://extendedxmlserializer.github.io/system\" xmlns:exs=\"https://extendedxmlserializer.github.io/v2\" exs:type=\"sys:List[sys:string]\"><Capacity>4</Capacity><sys:string>Item1</sys:string></List><Dictionary xmlns:sys=\"https://extendedxmlserializer.github.io/system\" xmlns:exs=\"https://extendedxmlserializer.github.io/v2\" exs:type=\"sys:Dictionary[sys:string,sys:string]\"><sys:Item><Key>Key</Key><Value>Value</Value></sys:Item></Dictionary><Set xmlns:ns1=\"clr-namespace:System.Collections.Generic;assembly=System.{ns}\" xmlns:sys=\"https://extendedxmlserializer.github.io/system\" xmlns:exs=\"https://extendedxmlserializer.github.io/v2\" exs:type=\"ns1:HashSet[sys:string]\"><sys:string>Item2</sys:string></Set></ExtendedXmlSerializerTests-ClassWithPropertyInterfaceOfList>");
            actual.Should().BeEquivalentTo(expected);
        }
Пример #2
0
        public void PropertyInterfaceOfList()
        {
            var expected = new ClassWithPropertyInterfaceOfList
            {
                List = new List <string> {
                    "Item1"
                },
                Set = new List <string> {
                    "Item1"
                }
            };

            var actual = new SerializationSupport(new ConfigurationContainer()).Cycle(expected);

            actual.List.Only()
            .Should()
            .NotBeNull()
            .And
            .Be(actual.Set.Only());
        }
Пример #3
0
        public void PropertyInterfaceOfListReferencesCleared()
        {
            var expected = new ClassWithPropertyInterfaceOfList
            {
                List = new List <string> {
                    "Item1"
                },
                Set = new List <string> {
                    "Item1"
                }
            };

            var container = new ConfigurationContainer();

            container.EnableReferences();
            container.IgnoredReferenceTypes().Clear();
            var actual = new SerializationSupport(container).Cycle(expected);

            actual.List.Only()
            .Should()
            .NotBeNull()
            .And.BeSameAs(actual.Set.Only());
        }