Exemple #1
0
        public void Unicode_SerializeAndBack_ValuesAreEqual(string value)
        {
            var deserialized =
                SerializeTestHelper.SerializeAndBack <UnicodeSerializer, UnicodeDeserializer, string>(value);

            Assert.AreEqual(value, deserialized);
        }
Exemple #2
0
        public void DateTime_SerializeAndBack_ValuesAreEqual()
        {
            var value        = new DateTime(2017, 10, 13, 14, 23, 15);
            var deserialized =
                SerializeTestHelper.SerializeAndBack <UTCFileTimeSerializer, UTCFileTimeDeserializer, DateTime>(value);

            Assert.Less(Math.Abs((value - deserialized).TotalMilliseconds), 1);
        }
Exemple #3
0
        public void DateTimeOffset_SerializeAndBack_ValuesAreEqual()
        {
            var value = DateTimeOffset.Now;

            var deserialized =
                SerializeTestHelper.SerializeAndBack <UTCFileTimeAndOffsetSerializer, UTCFileTimeAndOffsetDeserializer, DateTimeOffset>(value);

            Assert.AreEqual(value.Offset, deserialized.Offset);
            Assert.Less(Math.Abs((value.DateTime - deserialized.DateTime).TotalMilliseconds), 1);
        }
Exemple #4
0
        public void ErrorMessage_SerializeAndBack_ValuesAreEqual(short?messageId, short?askId, ErrorType type, string message)
        {
            var em           = new ErrorMessage(messageId, askId, type, message);
            var deserialized = SerializeTestHelper.SerializeAndBack <ErrorMessageSerializer, ErrorMessageDeserializer, ErrorMessage>(em);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(em.AskId, deserialized.AskId);
                Assert.AreEqual(em.MessageId, deserialized.MessageId);
                Assert.AreEqual(em.ErrorType, deserialized.ErrorType);
                Assert.AreEqual(em.AdditionalExceptionInformation, deserialized.AdditionalExceptionInformation);
            });
        }