public void Can_read_single_byte_message()
        {
            DisconnectMessageSerializer serializer = new DisconnectMessageSerializer();

            byte[]            serialized   = new byte[] { 16 };
            DisconnectMessage deserialized = serializer.Deserialize(serialized);

            Assert.AreEqual(DisconnectReason.Other, (DisconnectReason)deserialized.Reason, "reason");
        }
Пример #2
0
        public void Can_do_roundtrip()
        {
            DisconnectMessage           msg        = new DisconnectMessage(DisconnectReason.AlreadyConnected);
            DisconnectMessageSerializer serializer = new DisconnectMessageSerializer();

            byte[]            serialized   = serializer.Serialize(msg);
            DisconnectMessage deserialized = serializer.Deserialize(serialized);

            Assert.AreEqual(msg.Reason, deserialized.Reason);
        }
        public void Can_do_roundtrip()
        {
            DisconnectMessage           msg        = new DisconnectMessage(DisconnectReason.AlreadyConnected);
            DisconnectMessageSerializer serializer = new DisconnectMessageSerializer();

            byte[] serialized = serializer.Serialize(msg);
            Assert.AreEqual("0xc105", serialized.ToHexString(true), "bytes");
            DisconnectMessage deserialized = serializer.Deserialize(serialized);

            Assert.AreEqual(msg.Reason, deserialized.Reason, "reason");
        }