From fd02e45b2a2f38da25ee2d202ed911b684fe30ac Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Fri, 31 Jul 2015 10:32:04 +0100 Subject: Fix trivial bug in field orderings. (Shows the benefit of unit testing even code "too simple to fail"...) --- .../src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs') diff --git a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs index e84a0727..643816e6 100644 --- a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs +++ b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs @@ -238,5 +238,18 @@ namespace Google.Protobuf.Reflection Assert.IsNull(fieldDescriptor.Accessor); Assert.IsNull(messageDescriptor.GeneratedType); } + + // From TestFieldOrdering: + // string my_string = 11; + // int64 my_int = 1; + // float my_float = 101; + // NestedMessage single_nested_message = 200; + [Test] + public void FieldListOrderings() + { + var fields = TestFieldOrderings.Descriptor.Fields; + Assert.AreEqual(new[] { 11, 1, 101, 200 }, fields.InDeclarationOrder().Select(x => x.FieldNumber)); + Assert.AreEqual(new[] { 1, 11, 101, 200 }, fields.InFieldNumberOrder().Select(x => x.FieldNumber)); + } } } -- cgit v1.2.3