Exemple #1
0
//        [Fact(Skip = "Not ready")]
        public void SupportSerializingAndDeserializingProtobufs()
        {
            var any = AnySupport.Encode(AddLineItem);

            Assert.Equal("type.googleapis.com/" + AddLineItem.Descriptor.FullName,
                         any.TypeUrl);
            Assert.Equal(AddLineItem, AnySupport.Decode(any));
        }
Exemple #2
0
        public void TestPrimitive(string name, object value, object defaultValue)
        {
            var any = AnySupport.Encode(value);
            var res = AnySupport.Decode(any);

            Assert.Equal(value, res);

            // TODO: support for encoding (null as type)
            // any = AnySupport.Encode(null);
            // res = AnySupport.Decode(any);
            // Assert.Equal(defaultValue, res);
        }
Exemple #3
0
        public void TestPrimitiveBytes()
        {
            var str   = "foo";
            var bytes = ByteString.CopyFromUtf8(str);
            var any   = AnySupport.Encode(bytes);
            var res   = AnySupport.Decode(any) as ByteString;

            Assert.NotNull(res);
            Assert.Equal(bytes, res);

            var val = res.ToStringUtf8();

            Assert.Equal(str, val);
        }