Esempio n. 1
0
        public void Execute()
        {
            var m1   = new NameSpace1.M1();
            var m2_1 = new NameSpace2.M1();

            using (Stream stream = new MemoryStream())
            {
                var serializer = SerializerFactory.Create(typeof(IMyBusMessage), typeof(NameSpace1.M1), typeof(NameSpace2.M1));
                serializer.Serialize(new object[] { m2_1, m1 }, stream);

                stream.Position = 0;
                //   var readToEnd = new StreamReader(stream).ReadToEnd();

                var messageDeserialized = serializer.Deserialize(stream);
                Assert.IsInstanceOf <NameSpace2.M1>(messageDeserialized[0]);
                Assert.IsInstanceOf <NameSpace1.M1>(messageDeserialized[1]);
            }
        }
        public void Execute()
        {
            var m1 = new NameSpace1.M1();
            var m2_1 = new NameSpace2.M1();

            using (Stream stream = new MemoryStream())
            {
                var serializer = SerializerFactory.Create(typeof(IMyBusMessage), typeof(NameSpace1.M1), typeof(NameSpace2.M1));
                serializer.Serialize(new object[] { m2_1, m1 }, stream);

                stream.Position = 0;
                //   var readToEnd = new StreamReader(stream).ReadToEnd();

                var messageDeserialized = serializer.Deserialize(stream);
                Assert.IsInstanceOf<NameSpace2.M1>(messageDeserialized[0]);
                Assert.IsInstanceOf<NameSpace1.M1>(messageDeserialized[1]);
            }
        }