Пример #1
0
        void Verify()
        {
            var container  = ConfiguredContainer.New <CombinedProfile>();
            var serializer = container.UseOptimizedNamespaces()
                             .EnableParameterizedContent()
                             .EnableImplicitTyping(typeof(Outer))
                             //

                             .Create()
                             .ForTesting();

            serializer.Assert(new Outer("A", "B", "C"), @"<?xml version=""1.0"" encoding=""utf-8""?><OuterDataThings><Cc>C</Cc><Bb>B</Bb><Aa>A</Aa></OuterDataThings>");
        }
Пример #2
0
        public void Verify()
        {
            var serializer = ConfiguredContainer.New <Profile>()
                             .Create()
                             .ForTesting();

            var subject = new Subject {
                Message = "Hello World!"
            };

            serializer.Assert(subject, @"<?xml version=""1.0"" encoding=""utf-8""?><ConfiguredSubject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ReportedIssues;assembly=ExtendedXmlSerializer.Tests""><Message>Hello World!</Message></ConfiguredSubject>")
            .ShouldBeEquivalentTo(subject);
        }
Пример #3
0
        public void VerifyComposite()
        {
            var serializer = ConfiguredContainer.New <Combined>()
                             .Create()
                             .ForTesting();

            var subject = new Subject {
                Message = "Hello World!"
            };

            serializer.Assert(subject, @"<?xml version=""1.0"" encoding=""utf-8""?><ConfiguredSubject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ReportedIssues;assembly=ExtendedXmlSerializer.Tests"" />")
            .Message.Should()
            .BeNull();
        }
Пример #4
0
        void VerifyComposite()
        {
            IConfigurationContainer container = ConfiguredContainer.New <ComplexProfile>();

            IExtendedXmlSerializer serializer = container.UseAutoFormatting()
                                                .EnableImplicitTyping(typeof(Subject))
                                                .UseOptimizedNamespaces()
                                                .Create();
            var instance = new Subject {
                Message = "Hello World!", Number = 123
            };
            string document = serializer.Serialize(instance);

            document.Should()
            .Be(@"<?xml version=""1.0"" encoding=""utf-8""?><Issue282Tests_Profiles-Subject NewNumber=""123"" NewMessage=""Hello World!"" />");
        }
 public StatelessActor2()
 {
     _container   = new ConfiguredContainer();   //... container is configured in it's constructor
     _rootElement = _container.Resolve <IRootElement>();
 }
Пример #6
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 public ConfiguredSerializer() : this(ConfiguredContainer.New <T>().Create())
 {
 }