コード例 #1
0
        public void Deserialize()
        {
            var formatter = new EnumFormatterInt16 <Target>(new MessagePackProvider(), MessagePackContext.Empty);
            var reader    = new MessagePackReader(new byte[] { 0 });

            Target target = formatter.Deserialize(ref reader);

            Assert.AreEqual(Target.Value, target);
            Assert.Pass(reader.Print());
        }
コード例 #2
0
        public void Serialize()
        {
            var target    = Target.Value;
            var formatter = new EnumFormatterInt16 <Target>(new MessagePackProvider(), MessagePackContext.Empty);
            var writer    = new MessagePackWriter();

            formatter.Serialize(ref writer, target);

            Assert.NotNull(writer.Buffer);
            Assert.AreEqual(1, writer.Position);
            Assert.Pass(writer.Print());
        }