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);
        }
Exemple #2
0
        public void ListWithBasicNullElement()
        {
            var items = new[] { new Subject(), null, new Subject() }.ToList();
            var support = new SerializationSupport(_serializer);

            support.Cycle(items).ShouldBeEquivalentTo(items);
        }
Exemple #3
0
        public void Verify()
        {
            var container = new Optimizations();
            var sut       = new Alteration(container);
            var support   = new SerializationSupport(new ConfigurationContainer().Alter(sut)
                                                     .Create());

            const float number = 4.5678f;
            var         actual =
                support.Assert(number,
                               @"<?xml version=""1.0"" encoding=""utf-8""?><float xmlns=""https://extendedxmlserializer.github.io/system"">4.5678</float>");

            Assert.Equal(number, actual);

            var converter = sut.Get(FloatConverter.Default);
            var format    = converter.Format(number);

            for (var i = 0; i < 10; i++)
            {
                Assert.Same(format, converter.Format(number));
            }

            container.Clear();
            Assert.NotSame(format, converter.Format(number));
        }
Exemple #4
0
        public void Invalid()
        {
            var serializer = new SerializationSupport(new ConfigurationContainer().EnableParameterizedContent());
            var expected   = new SubjectWithInvalidConstructor("Hello World!", 6776);

            Assert.Throws <InvalidOperationException>(() => serializer.Serialize(expected));
        }
        public void Verify()
        {
            var subject = new Subject {
                Message = "Hello World!"
            };

            NameProperty.Default.Assign(subject, "SubjectName");
            NumberProperty.Default.Assign(subject, 6776);

            var serializer = new SerializationSupport(
                new ConfigurationContainer()
                .EnableAttachedProperties(NameProperty.Default,
                                          NumberProperty.Default)
                );

            var actual = serializer.Assert(subject,
                                           @"<?xml version=""1.0"" encoding=""utf-8""?><AttachedPropertiesExtensionTests-Subject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.AttachedProperties;assembly=ExtendedXmlSerializer.Tests""><Message>Hello World!</Message><AttachedPropertiesExtensionTests-NameProperty.Default>SubjectName</AttachedPropertiesExtensionTests-NameProperty.Default><AttachedPropertiesExtensionTests-NumberProperty.Default>6776</AttachedPropertiesExtensionTests-NumberProperty.Default></AttachedPropertiesExtensionTests-Subject>");

            actual.Should().BeEquivalentTo(subject);
            actual.Get(NameProperty.Default)
            .Should()
            .Be("SubjectName");
            actual.Get(NumberProperty.Default)
            .Should()
            .Be(6776);
        }
        public void VerifyConfiguration()
        {
            var subject = new Subject {
                Message = "Hello World!"
            };

            subject.Set(NumberProperty.Default, 6776);

            var container = new ConfigurationContainer();

            container.UseAutoFormatting()
            .Type <NumberProperty>()
            .Name("ConfiguredAttachedProperty");

            container.AttachedProperty(() => NumberProperty.Default)
            .Name("NewNumberPropertyName");
            var serializer = new SerializationSupport(container);

            var actual = serializer.Assert(subject,
                                           @"<?xml version=""1.0"" encoding=""utf-8""?><AttachedPropertiesExtensionTests-Subject Message=""Hello World!"" ConfiguredAttachedProperty.NewNumberPropertyName=""6776"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.AttachedProperties;assembly=ExtendedXmlSerializer.Tests"" />");

            actual.Should().BeEquivalentTo(subject);
            actual.Get(NumberProperty.Default)
            .Should()
            .Be(6776);
        }
Exemple #7
0
        public void ConfigureEncrypt()
        {
            var configuration = new ConfigurationContainer();

            Assert.Null(configuration.Root.Find <EncryptionExtension>());
            configuration.UseEncryptionAlgorithm()
            .ConfigureType <TestClassWithEncryptedData>()
            .Member(p => p.Password, x => x.Encrypt())
            .Member(p => p.Salary)
            .Encrypt();

            var extension = configuration.Root.Find <EncryptionExtension>();

            Assert.NotNull(extension);
            var type = configuration.GetTypeConfiguration(typeof(TestClassWithEncryptedData));

            Assert.NotNull(type);

            var member   = type.Member(nameof(TestClassWithEncryptedData.Salary));
            var property = ((ISource <MemberInfo>)member).Get();

            Assert.NotNull(property);
            Assert.Contains(property, extension.Registered);

            const int salary   = 6776;
            var       instance = new TestClassWithEncryptedData {
                Salary = salary
            };
            var support = new SerializationSupport(configuration);
            var actual  = support.Assert(instance, @"<?xml version=""1.0"" encoding=""utf-8""?><TestClassWithEncryptedData xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.TestObject;assembly=ExtendedXmlSerializer.Tests""><Salary>Njc3Ng==</Salary></TestClassWithEncryptedData>");

            Assert.Equal(salary, actual.Salary);
        }
Exemple #8
0
        public void Verify()
        {
            const string target = "I am Attribute, Hear me roar! #rawr!";

            var configuration = new ConfigurationContainer();

            configuration.Type <SimpleSubject>()
            .Member(x => x.Message)
            .Attribute(x => x == target);

            var support  = new SerializationSupport(configuration);
            var expected = new SimpleSubject {
                Message = "Hello World!", Number = 6776
            };
            var content = support.Assert(expected,
                                         @"<?xml version=""1.0"" encoding=""utf-8""?><AttributeSpecificationTests-SimpleSubject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ContentModel.Members;assembly=ExtendedXmlSerializer.Tests""><Message>Hello World!</Message><Number>6776</Number></AttributeSpecificationTests-SimpleSubject>");

            Assert.Equal(expected.Message, content.Message);
            Assert.Equal(expected.Number, content.Number);

            expected.Message = target;
            var attributes = support.Assert(expected,
                                            @"<?xml version=""1.0"" encoding=""utf-8""?><AttributeSpecificationTests-SimpleSubject Message=""I am Attribute, Hear me roar! #rawr!"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ContentModel.Members;assembly=ExtendedXmlSerializer.Tests""><Number>6776</Number></AttributeSpecificationTests-SimpleSubject>");

            Assert.Equal(expected.Message, attributes.Message);
            Assert.Equal(expected.Number, attributes.Number);
        }
        public void VerifyAttributes()
        {
            var subject = new Subject {
                Message = "Hello World!"
            };

            subject.Set(NameProperty.Default, "SubjectName");
            subject.Set(NumberProperty.Default, 6776);

            var serializer =
                new SerializationSupport(new ConfigurationContainer().UseAutoFormatting()
                                         .EnableAttachedProperties(NameProperty.Default,
                                                                   NumberProperty
                                                                   .Default));
            var actual = serializer.Assert(subject,
                                           @"<?xml version=""1.0"" encoding=""utf-8""?><AttachedPropertiesExtensionTests-Subject Message=""Hello World!"" AttachedPropertiesExtensionTests-NameProperty.Default=""SubjectName"" AttachedPropertiesExtensionTests-NumberProperty.Default=""6776"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.AttachedProperties;assembly=ExtendedXmlSerializer.Tests"" />");

            actual.Should().BeEquivalentTo(subject);
            actual.Get(NameProperty.Default)
            .Should()
            .Be("SubjectName");
            actual.Get(NumberProperty.Default)
            .Should()
            .Be(6776);
        }
        public void Field()
        {
            var support  = new SerializationSupport();
            var expected = new Subject("Hello", "World!");
            var actual   = support.Assert(expected, @"<?xml version=""1.0"" encoding=""utf-8""?><CollectionContentOptionTests-Subject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ContentModel.Collections;assembly=ExtendedXmlSerializer.Tests""><_children><Capacity>4</Capacity><string xmlns=""https://extendedxmlserializer.github.io/system"">Hello</string><string xmlns=""https://extendedxmlserializer.github.io/system"">World!</string></_children></CollectionContentOptionTests-Subject>");

            Assert.Equal(expected.ToArray(), actual.ToArray());
        }
Exemple #11
0
        public void PrivateConstructor()
        {
            var container = new ConfigurationContainer().EnableAllConstructors().Create();
            var support   = new SerializationSupport(container);
            var instance  = Subject.Create("Hello World from Private Constructor (hopefully)!");

            support.Cycle(instance).ShouldBeEquivalentTo(instance);
        }
Exemple #12
0
        public void Verify()
        {
            var serializer = new SerializationSupport(new ConfigurationContainer().EnableParameterizedContent());
            var expected   = new Subject("Hello World!");
            var actual     = serializer.Assert(expected,
                                               @"<?xml version=""1.0"" encoding=""utf-8""?><ParameterizedMembersExtensionTests-Subject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Content.Members;assembly=ExtendedXmlSerializer.Tests""><Message>Hello World!</Message></ParameterizedMembersExtensionTests-Subject>");

            Assert.Equal(expected.Message, actual.Message);
        }
Exemple #13
0
        public void TestClassInheritanceWithDefaultOrder()
        {
            TestClassInheritanceBase expected = new TestClassInheritance();

            expected.Init();
            var actual = new SerializationSupport().Assert(expected, @"<?xml version=""1.0"" encoding=""utf-8""?><TestClassInheritance xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.TestObject;assembly=ExtendedXmlSerializer.Tests""><Id>2</Id><Id2>3</Id2></TestClassInheritance>");

            actual.ShouldBeEquivalentTo(expected);
        }
Exemple #14
0
        public void BasicTuple()
        {
            var serializer = new SerializationSupport(new ConfigurationContainer().EnableParameterizedContent());
            var expected   = new Tuple <string>("Hello World!");
            var actual     = serializer.Assert(expected,
                                               @"<?xml version=""1.0"" encoding=""utf-8""?><Tuple xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:arguments=""string"" xmlns=""https://extendedxmlserializer.github.io/system""><Item1>Hello World!</Item1></Tuple>");

            actual.ShouldBeEquivalentTo(expected);
        }
Exemple #15
0
        public void Verify()
        {
            var instance = new byte[] { 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1 };

            var support = new SerializationSupport();
            var actual  = support.Assert(instance, @"<?xml version=""1.0"" encoding=""utf-8""?><Array xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:item=""unsignedByte"" xmlns=""https://extendedxmlserializer.github.io/system"">AQIDBAUGBwcGBQQDAgE=</Array>");

            Assert.Equal(instance, actual);
        }
Exemple #16
0
        public void ComplexList()
        {
            var container = new ConfigurationContainer();

            container.Type <TestClassReference>()
            .EnableReferences(x => x.Id);
            var support = new SerializationSupport(container);

            var instance = new TestClassReferenceWithList {
                Parent = new TestClassReference {
                    Id = 1
                }
            };
            var other = new TestClassReference
            {
                Id = 2, ObjectA = instance.Parent, ReferenceToObjectA = instance.Parent
            };

            instance.All = new List <IReference>
            {
                new TestClassReference {
                    Id = 3, ObjectA = instance.Parent, ReferenceToObjectA = instance.Parent
                },
                new TestClassReference {
                    Id = 4, ObjectA = other, ReferenceToObjectA = other
                },
                other,
                instance.Parent
            };
            var actual = support.Assert(instance,
                                        @"<?xml version=""1.0"" encoding=""utf-8""?><TestClassReferenceWithList xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.TestObject;assembly=ExtendedXmlSerializer.Tests""><Parent xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:type=""TestClassReference"" Id=""1"" /><All><Capacity>4</Capacity><TestClassReference Id=""3""><ObjectA xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:type=""TestClassReference"" exs:entity=""1"" /><ReferenceToObjectA xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:type=""TestClassReference"" exs:entity=""1"" /></TestClassReference><TestClassReference Id=""4""><ObjectA xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:type=""TestClassReference"" Id=""2""><ObjectA exs:type=""TestClassReference"" exs:entity=""1"" /><ReferenceToObjectA exs:type=""TestClassReference"" exs:entity=""1"" /></ObjectA><ReferenceToObjectA xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:type=""TestClassReference"" exs:entity=""2"" /></TestClassReference><TestClassReference xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:entity=""2"" /><TestClassReference xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:entity=""1"" /></All></TestClassReferenceWithList>");

            Assert.NotNull(actual.Parent);
            var list = actual.All.Cast <TestClassReference>()
                       .ToList();

            Assert.Same(actual.Parent, list[0]
                        .ObjectA);
            Assert.Same(actual.Parent, list[0]
                        .ReferenceToObjectA);
            Assert.Same(list[1]
                        .ObjectA, list[1]
                        .ReferenceToObjectA);
            Assert.Same(list[1]
                        .ObjectA.To <TestClassReference>()
                        .ObjectA,
                        list[1]
                        .ObjectA.To <TestClassReference>()
                        .ReferenceToObjectA);
            Assert.Same(actual.Parent, list[1]
                        .ObjectA.To <TestClassReference>()
                        .ObjectA);
            Assert.Same(list[2], list[1]
                        .ObjectA);
            Assert.Same(actual.Parent, list[3]);
        }
        public void Verify()
        {
            var expected  = ImmutableArray.Create("Hello", "World!");
            var container = new ConfigurationContainer();
            // container.EnableImmutableArrays();
            var serializer = new SerializationSupport(container);
            var actual     = serializer.Assert(expected, @"<?xml version=""1.0"" encoding=""utf-8""?><ImmutableArray xmlns:sys=""https://extendedxmlserializer.github.io/system"" xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:arguments=""sys:string"" xmlns=""clr-namespace:System.Collections.Immutable;assembly=System.Collections.Immutable""><sys:string>Hello</sys:string><sys:string>World!</sys:string></ImmutableArray>");

            Assert.True(expected.SequenceEqual(actual));
        }
        public void VerifyMarkupExtension()
        {
            var container = new ConfigurationContainer();

            container.EnableMarkupExtensions();
            var serializer = new SerializationSupport(container);
            var subject    = serializer.Deserialize <TypedSubject>(@"<?xml version=""1.0"" encoding=""utf-8""?><MarkupExtensionTests-TypedSubject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Markup;assembly=ExtendedXmlSerializer.Tests"" xmlns:exs=""https://extendedxmlserializer.github.io/v2"" xmlns:sys=""https://extendedxmlserializer.github.io/system""  AnotherProperty=""{MarkupExtensionTests-TypeName {exs:Type sys:dateTime}}"" />");

            subject.AnotherProperty.Should().Be(typeof(DateTime).AssemblyQualifiedName);
        }
Exemple #19
0
        public void CreatedTuple()
        {
            var serializer = new SerializationSupport(new ConfigurationContainer().EnableParameterizedContent());
            var expected   = Tuple.Create("Hello World!", 6776, TypeCode.Empty);

            var actual = serializer.Assert(expected,
                                           @"<?xml version=""1.0"" encoding=""utf-8""?><Tuple xmlns:exs=""https://extendedxmlserializer.github.io/v2"" exs:arguments=""string,int,TypeCode"" xmlns=""https://extendedxmlserializer.github.io/system""><Item1>Hello World!</Item1><Item2>6776</Item2><Item3>Empty</Item3></Tuple>");

            actual.ShouldBeEquivalentTo(expected);
        }
        public void VerifyWithParameterAndProperty()
        {
            var container = new ConfigurationContainer();

            container.EnableMarkupExtensions();
            var serializer = new SerializationSupport(container);
            var subject    = serializer.Deserialize <Subject>(@"<?xml version=""1.0"" encoding=""utf-8""?><MarkupExtensionTests-Subject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Markup;assembly=ExtendedXmlSerializer.Tests"" PropertyName=""{MarkupExtensionTests-Extension 'Provided Message!', Number=3 * 4}"" />");

            subject.PropertyName.Should().Be(string.Concat(Extension.Message, "Provided Message!", " 12"));
        }
        public void VerifyDeclared()
        {
            var instance = new Subject {
                PropertyName = "Testing"
            };
            var actual = new SerializationSupport().Assert(instance,
                                                           @"<?xml version=""1.0"" encoding=""utf-8""?><MemberFormatExtensionTests-Subject PropertyName=""Testing"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Xml;assembly=ExtendedXmlSerializer.Tests"" />");

            Assert.Equal(instance.PropertyName, actual.PropertyName);
        }
        public void VerifyDifferentName()
        {
            var expected = new SubjectWithName {
                PropertyName = "Testing"
            };
            var actual = new SerializationSupport().Assert(expected,
                                                           @"<?xml version=""1.0"" encoding=""utf-8""?><MemberFormatExtensionTests-SubjectWithName AnotherDifferentName=""Testing"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Xml;assembly=ExtendedXmlSerializer.Tests"" />");

            Assert.Equal(expected.PropertyName, actual.PropertyName);
        }
        public void VerifyAutoFormattingWithLongContent()
        {
            var support  = new SerializationSupport(new ConfigurationContainer().UseAutoFormatting().Create());
            var instance = TestClassPrimitiveTypes.Create();

            instance.PropString =
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed urna sapien, pulvinar et consequat sit amet, fermentum in volutpat. This sentence should break the property out into content.";

            support.Assert(instance, @"<?xml version=""1.0"" encoding=""utf-8""?><TestClassPrimitiveTypes PropInt=""-1"" PropuInt=""2234"" PropDecimal=""3.346"" PropDecimalMinValue=""-79228162514264337593543950335"" PropDecimalMaxValue=""79228162514264337593543950335"" PropFloat=""7.4432"" PropFloatNaN=""NaN"" PropFloatPositiveInfinity=""INF"" PropFloatNegativeInfinity=""-INF"" PropFloatMinValue=""-3.40282347E+38"" PropFloatMaxValue=""3.40282347E+38"" PropDouble=""3.4234"" PropDoubleNaN=""NaN"" PropDoublePositiveInfinity=""INF"" PropDoubleNegativeInfinity=""-INF"" PropDoubleMinValue=""-1.7976931348623157E+308"" PropDoubleMaxValue=""1.7976931348623157E+308"" PropEnum=""EnumValue1"" PropLong=""234234142"" PropUlong=""2345352534"" PropShort=""23"" PropUshort=""2344"" PropDateTime=""2014-01-23T00:00:00"" PropByte=""23"" PropSbyte=""33"" PropChar=""g"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.TestObject;assembly=ExtendedXmlSerializer.Tests""><PropString>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed urna sapien, pulvinar et consequat sit amet, fermentum in volutpat. This sentence should break the property out into content.</PropString></TestClassPrimitiveTypes>");
        }
        public void VerifyProperty()
        {
            var instance = new Subject {
                Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1 }
            };

            var support = new SerializationSupport();
            var actual  = support.Cycle(instance);

            Assert.Equal(instance.Bytes, actual.Bytes);
        }
        public void NullNullable()
        {
            var expected = new NullableSubject {
                Number = null
            };
            var actual =
                new SerializationSupport().Assert(expected,
                                                  @"<?xml version=""1.0"" encoding=""utf-8""?><ExtendedXmlSerializerTests-NullableSubject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Xml;assembly=ExtendedXmlSerializer.Tests"" />");

            Assert.Equal(expected.Number, actual.Number);
        }
        public void VerifyAutoFormattingForNullableWithValue()
        {
            var support  = new SerializationSupport(new ConfigurationContainer().UseAutoFormatting().Create());
            var instance = new TestClassPrimitiveTypesNullable();

            instance.Init();
            var data     = support.Serialize(instance);
            var expected = @"<?xml version=""1.0"" encoding=""utf-8""?><TestClassPrimitiveTypesNullable PropString=""TestString"" PropInt=""-1"" PropuInt=""2234"" PropDecimal=""3.346"" PropFloat=""7.4432"" PropDouble=""3.4234"" PropEnum=""EnumValue1"" PropLong=""234234142"" PropUlong=""2345352534"" PropShort=""23"" PropUshort=""2344"" PropDateTime=""2014-01-23T00:00:00"" PropByte=""23"" PropSbyte=""33"" PropChar=""g"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.TestObject;assembly=ExtendedXmlSerializer.Tests"" />";

            data.ShouldBeEquivalentTo(expected);
        }
        public void VerifyAutoFormatting()
        {
            var support  = new SerializationSupport(new ConfigurationContainer().UseAutoFormatting().Create());
            var instance = TestClassPrimitiveTypes.Create();
            var data     = support.Serialize(instance);

            Assert.Equal(
                @"<?xml version=""1.0"" encoding=""utf-8""?><TestClassPrimitiveTypes PropString=""TestString"" PropInt=""-1"" PropuInt=""2234"" PropDecimal=""3.346"" PropDecimalMinValue=""-79228162514264337593543950335"" PropDecimalMaxValue=""79228162514264337593543950335"" PropFloat=""7.4432"" PropFloatNaN=""NaN"" PropFloatPositiveInfinity=""INF"" PropFloatNegativeInfinity=""-INF"" PropFloatMinValue=""-3.40282347E+38"" PropFloatMaxValue=""3.40282347E+38"" PropDouble=""3.4234"" PropDoubleNaN=""NaN"" PropDoublePositiveInfinity=""INF"" PropDoubleNegativeInfinity=""-INF"" PropDoubleMinValue=""-1.7976931348623157E+308"" PropDoubleMaxValue=""1.7976931348623157E+308"" PropEnum=""EnumValue1"" PropLong=""234234142"" PropUlong=""2345352534"" PropShort=""23"" PropUshort=""2344"" PropDateTime=""2014-01-23T00:00:00"" PropByte=""23"" PropSbyte=""33"" PropChar=""g"" xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.TestObject;assembly=ExtendedXmlSerializer.Tests"" />",
                data
                );
        }
        public void Guid()
        {
            var expected = new GuidProperty {
                Guid = new Guid("7db85a35-1f66-4e5c-9c4a-33a937a9258b")
            };
            var actual =
                new SerializationSupport().Assert(expected,
                                                  @"<?xml version=""1.0"" encoding=""utf-8""?><ExtendedXmlSerializerTests-GuidProperty xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Xml;assembly=ExtendedXmlSerializer.Tests""><Guid>7db85a35-1f66-4e5c-9c4a-33a937a9258b</Guid></ExtendedXmlSerializerTests-GuidProperty>");

            Assert.Equal(expected.Guid, actual.Guid);
        }
        public void Point()
        {
            var expected = new PointProperty {
                Point = new System.Windows.Point(10, 20)
            };
            var actual =
                new SerializationSupport().Assert(expected,
                                                  @"<?xml version=""1.0"" encoding=""utf-8""?><ExtendedXmlSerializerTests-PointProperty xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ExtensionModel.Xml;assembly=ExtendedXmlSerializer.Tests""><Point><X>10</X><Y>20</Y></Point></ExtendedXmlSerializerTests-PointProperty>");

            Assert.Equal(expected.Point, actual.Point);
        }
        public void CustomCollection()
        {
            var expected = new TestClassCollection {
                TestClassPrimitiveTypes.Create()
            };
            var actual =
                new SerializationSupport().Assert(expected,
                                                  @"<?xml version=""1.0"" encoding=""utf-8""?><TestClassCollection xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.TestObject;assembly=ExtendedXmlSerializer.Tests""><TestClassPrimitiveTypes><PropString>TestString</PropString><PropInt>-1</PropInt><PropuInt>2234</PropuInt><PropDecimal>3.346</PropDecimal><PropDecimalMinValue>-79228162514264337593543950335</PropDecimalMinValue><PropDecimalMaxValue>79228162514264337593543950335</PropDecimalMaxValue><PropFloat>7.4432</PropFloat><PropFloatNaN>NaN</PropFloatNaN><PropFloatPositiveInfinity>INF</PropFloatPositiveInfinity><PropFloatNegativeInfinity>-INF</PropFloatNegativeInfinity><PropFloatMinValue>-3.40282347E+38</PropFloatMinValue><PropFloatMaxValue>3.40282347E+38</PropFloatMaxValue><PropDouble>3.4234</PropDouble><PropDoubleNaN>NaN</PropDoubleNaN><PropDoublePositiveInfinity>INF</PropDoublePositiveInfinity><PropDoubleNegativeInfinity>-INF</PropDoubleNegativeInfinity><PropDoubleMinValue>-1.7976931348623157E+308</PropDoubleMinValue><PropDoubleMaxValue>1.7976931348623157E+308</PropDoubleMaxValue><PropEnum>EnumValue1</PropEnum><PropLong>234234142</PropLong><PropUlong>2345352534</PropUlong><PropShort>23</PropShort><PropUshort>2344</PropUshort><PropDateTime>2014-01-23T00:00:00</PropDateTime><PropByte>23</PropByte><PropSbyte>33</PropSbyte><PropChar>g</PropChar></TestClassPrimitiveTypes></TestClassCollection>");

            actual.Should().BeEquivalentTo(expected);
        }