AjErl.Tests.Communication.TypeSerializerTests.SerializeDeserializeType C# (CSharp) Метод

SerializeDeserializeType() приватный Метод

private SerializeDeserializeType ( ) : void
Результат void
        public void SerializeDeserializeType()
        {
            var serializer = new TypeSerializer(typeof(Person));

            MemoryStream stream = new MemoryStream();
            OutputChannel output = new OutputChannel(new BinaryWriter(stream));
            output.Write(serializer);
            stream.Seek(0, SeekOrigin.Begin);

            InputChannel channel = new InputChannel(new BinaryReader(stream));

            var result = channel.Read(true);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(TypeSerializer));

            var newserializer = (TypeSerializer)result;
            var props = newserializer.Properties;

            Assert.IsNotNull(props);
            Assert.AreEqual(3, props.Count);

            Assert.AreEqual("Id", props[0].Name);
            Assert.AreEqual(Types.Integer, props[0].Type);
            Assert.IsNull(props[0].TypeName);

            Assert.AreEqual("FirstName", props[1].Name);
            Assert.AreEqual(Types.String, props[1].Type);
            Assert.IsNull(props[1].TypeName);

            Assert.AreEqual("LastName", props[2].Name);
            Assert.AreEqual(Types.String, props[2].Type);
            Assert.IsNull(props[2].TypeName);
        }