Fixed parsing of BoolValue.

pull/1517/head
Jos Hickson 9 years ago
parent 2b22b611a8
commit 835fb947cc
  1. 7
      csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
  2. 3
      csharp/src/Google.Protobuf/JsonParser.cs

@ -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
{ 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

Loading…
Cancel
Save