Exemple #1
0
        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())
            {
                var serializer = SerializationFactory.GetXmlSerializer();

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

                var c2 = serializer.Deserialize <ContainerInterfaces>(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, null);
                memoryStream.Position = 0L;
                var c2 = ContainerInterfaces.Load(memoryStream, SerializationMode.Xml, null);
                Assert.AreEqual(c, c2);
            }
        }