aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf.Test/WellKnownTypes
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-07-22 15:14:38 +0100
committerGravatar Jon Skeet <jonskeet@google.com>2015-07-22 20:13:37 +0100
commit20bf6a563a94e5772fdb7b1bd6530404b2ea2c0b (patch)
tree49a153ddecda0bb9b89640637e15ad93f7e42d6c /csharp/src/Google.Protobuf.Test/WellKnownTypes
parent7b5c3967991b6534f439cb31b0d247501f4a0ef8 (diff)
First pass at making field access simpler.
This is definitely not ready to ship - I'm "troubled" by the disconnect between a list of fields in declaration order, and a mapping of field accessors by field number/name. Discussion required, but I find that easier when we've got code to look at :)
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/WellKnownTypes')
-rw-r--r--csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
index c617db36..a8288483 100644
--- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
+++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
@@ -192,7 +192,7 @@ namespace Google.Protobuf.WellKnownTypes
Uint32Field = 3,
Uint64Field = 4
};
- var fields = TestWellKnownTypes.Descriptor.FieldAccessorsByFieldNumber;
+ var fields = TestWellKnownTypes.Descriptor.FieldAccessors;
Assert.AreEqual("x", fields[TestWellKnownTypes.StringFieldFieldNumber].GetValue(message));
Assert.AreEqual(ByteString.CopyFrom(1, 2, 3), fields[TestWellKnownTypes.BytesFieldFieldNumber].GetValue(message));
@@ -216,7 +216,7 @@ namespace Google.Protobuf.WellKnownTypes
{
// Just a single example... note that we can't have a null value here
var message = new RepeatedWellKnownTypes { Int32Field = { 1, 2 } };
- var fields = RepeatedWellKnownTypes.Descriptor.FieldAccessorsByFieldNumber;
+ var fields = RepeatedWellKnownTypes.Descriptor.FieldAccessors;
var list = (IList) fields[RepeatedWellKnownTypes.Int32FieldFieldNumber].GetValue(message);
CollectionAssert.AreEqual(new[] { 1, 2 }, list);
}
@@ -226,7 +226,7 @@ namespace Google.Protobuf.WellKnownTypes
{
// Just a single example... note that we can't have a null value here
var message = new MapWellKnownTypes { Int32Field = { { 1, 2 }, { 3, null } } };
- var fields = MapWellKnownTypes.Descriptor.FieldAccessorsByFieldNumber;
+ var fields = MapWellKnownTypes.Descriptor.FieldAccessors;
var dictionary = (IDictionary) fields[MapWellKnownTypes.Int32FieldFieldNumber].GetValue(message);
Assert.AreEqual(2, dictionary[1]);
Assert.IsNull(dictionary[3]);