Commit cca2d44e authored by Jon Skeet's avatar Jon Skeet

Merge pull request #1517 from jhickson/boolvalue

Fix C# Json parsing of well-known type Boolvalue
parents a1938b2a 835fb947
...@@ -417,5 +417,12 @@ namespace Google.Protobuf.WellKnownTypes ...@@ -417,5 +417,12 @@ namespace Google.Protobuf.WellKnownTypes
TestWellKnownTypes.Descriptor.Fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.Clear(message); TestWellKnownTypes.Descriptor.Fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.Clear(message);
Assert.IsNull(message.StringField); Assert.IsNull(message.StringField);
} }
[Test]
public void GivenBoolValueWhenPerformingRoundTripEncodingViaJsonThenShouldNotExpectObjectAtTopLevel()
{
var value = new BoolValue { Value = true };
Assert.AreEqual(value, JsonParser.Default.Parse<BoolValue>(JsonFormatter.Default.Format(value)));
}
} }
} }
...@@ -86,7 +86,8 @@ namespace Google.Protobuf ...@@ -86,7 +86,8 @@ namespace Google.Protobuf
{ FloatValue.Descriptor.FullName, MergeWrapperField }, { FloatValue.Descriptor.FullName, MergeWrapperField },
{ DoubleValue.Descriptor.FullName, MergeWrapperField }, { DoubleValue.Descriptor.FullName, MergeWrapperField },
{ BytesValue.Descriptor.FullName, MergeWrapperField }, { BytesValue.Descriptor.FullName, MergeWrapperField },
{ StringValue.Descriptor.FullName, MergeWrapperField } { StringValue.Descriptor.FullName, MergeWrapperField },
{ BoolValue.Descriptor.FullName, MergeWrapperField }
}; };
// Convenience method to avoid having to repeat the same code multiple times in the above // Convenience method to avoid having to repeat the same code multiple times in the above
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment