Ejemplo n.º 1
0
        public void Null()
        {
            var protoSerializer   = new ProtobufSerializer <UInt32Value>(schemaRegistryClient);
            var protoDeserializer = new ProtobufDeserializer <UInt32Value>();

            var bytes = protoSerializer.SerializeAsync(null, new SerializationContext(MessageComponentType.Value, testTopic)).Result;

            Assert.Null(bytes);
            Assert.Null(protoDeserializer.DeserializeAsync(bytes, true, new SerializationContext(MessageComponentType.Value, testTopic)).Result);
        }
Ejemplo n.º 2
0
        public void UInt32SerDe()
        {
            var protoSerializer   = new ProtobufSerializer <UInt32Value>(schemaRegistryClient);
            var protoDeserializer = new ProtobufDeserializer <UInt32Value>();

            var v = new UInt32Value {
                Value = 1234
            };
            var bytes = protoSerializer.SerializeAsync(v, new SerializationContext(MessageComponentType.Value, testTopic)).Result;

            Assert.Equal(v.Value, protoDeserializer.DeserializeAsync(bytes, false, new SerializationContext(MessageComponentType.Value, testTopic)).Result.Value);
        }