예제 #1
0
        public void JSONSerialiser_Serialisation_DoesntThrowOnValidData()
        {
            IBaseMessage message        = ISerializerTestsData.GenerateMessage();
            ISerializer  jsonSerialiser = new JSONSerialiser();

            jsonSerialiser.Serialize(message);
        }
예제 #2
0
        public void BinaryFormatter_Serialisation_DoesntThrow()
        {
            IBaseMessage message         = ISerializerTestsData.GenerateMessage();
            ISerializer  binaryFormatter = new BinaryFormatter();

            binaryFormatter.Serialize(message);
        }
예제 #3
0
        public void JSONSerialiser_Deserialisation_DoesntThrowOnValidData()
        {
            IBaseMessage message        = ISerializerTestsData.GenerateMessage();
            ISerializer  jsonSerialiser = new JSONSerialiser();

            byte[] messageBytes = jsonSerialiser.Serialize(message);

            IBaseMessage messageDeserialized = jsonSerialiser.Deserialize(messageBytes);

            Assert.AreEqual(message.To, messageDeserialized.To);
            Assert.AreEqual(message.From, messageDeserialized.From);
            Assert.AreEqual(message.Type, messageDeserialized.Type);
            Assert.AreEqual(message.Version, messageDeserialized.Version);
        }
예제 #4
0
        public void BinaryFormatter_Deserialisation_DoesntThrow()
        {
            IBaseMessage message         = ISerializerTestsData.GenerateMessage();
            ISerializer  binaryFormatter = new BinaryFormatter();

            byte[] messageBytes = binaryFormatter.Serialize(message);

            IBaseMessage messageDeserialized = binaryFormatter.Deserialize(messageBytes);

            Assert.AreEqual(message.To, messageDeserialized.To);
            Assert.AreEqual(message.From, messageDeserialized.From);
            Assert.AreEqual(message.Type, messageDeserialized.Type);
            Assert.AreEqual(message.Version, messageDeserialized.Version);
        }