Beispiel #1
0
        public void Run()
        {
            var msg = new MessageA("foo");

            var bytes = MessagePackSerializer.Serialize(msg, WithTestMessageResolver.Instance);
            var msg1  = MessagePackSerializer.Deserialize <ITestMessage>(bytes, WithTestMessageResolver.Instance);

            Assert.NotNull(msg1);
            Assert.Equal("fooX", msg1.Data);
        }
Beispiel #2
0
        public void RunTypeless()
        {
            var msg = new MessageA("foo");

            //var bytes = MessagePackSerializer.Serialize<object>(msg, WithTestMessageTypelessResolver.Instance);
            //var msg1 = (ITestMessage)MessagePackSerializer.Deserialize<object>(bytes, WithTestMessageTypelessResolver.Instance);
            var msg1 = (ITestMessage)MessagePackSerializer.Typeless.DeepCopy(msg, WithTestMessageTypelessResolver.Instance);

            Assert.NotNull(msg1);
            Assert.Equal("fooX", msg1.Data);
        }