Example #1
0
        public void EnumerableOfAbstractClassesViaKnownTypes_SameNameDifferentNamespaces_SaveLoadRoundTrip()
        {
            var c = new ContainerAbstractClasses();

            var pA = new PluginA.Params();

            pA.SettingA = "TestA";
            c.Parameters.Add(pA);

            var pB = new PluginB.Params();

            pB.SettingB = "TestB";
            c.Parameters.Add(pB);

            using (var memoryStream = new MemoryStream())
            {
                var serializer = SerializationFactory.GetXmlSerializer();

                c.Save(memoryStream, serializer);
                memoryStream.Position = 0L;

                var c2 = serializer.Deserialize <ContainerAbstractClasses>(memoryStream);

                Assert.AreEqual(c, c2);
            }
        }
        public void EnumerableOfInterfacesViaKnownTypes_SameNameDifferentNamespaces_SaveLoadRoundTrip()
        {
            var c = new ContainerInterfaces();

            var pA = new PluginA.Params();

            pA.SettingA = "TestA";
            c.Parameters.Add(pA);

            var pB = new PluginB.Params();

            pB.SettingB = "TestB";
            c.Parameters.Add(pB);

            using (var memoryStream = new MemoryStream())
            {
                c.Save(memoryStream, SerializationMode.Xml);
                memoryStream.Position = 0L;
                var c2 = ContainerInterfaces.Load(memoryStream, SerializationMode.Xml);
                Assert.AreEqual(c, c2);
            }
        }