Commit abd7083b authored by Jan Tattermusch's avatar Jan Tattermusch

Merge pull request #667 from jskeet/fix-field-orderings

Fix trivial bug in field orderings.
parents c20f67fd fd02e45b
......@@ -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));
}
}
}
......@@ -250,7 +250,7 @@ namespace Google.Protobuf.Reflection
/// </value>
public IList<FieldDescriptor> InFieldNumberOrder()
{
return messageDescriptor.fieldsInDeclarationOrder;
return messageDescriptor.fieldsInNumberOrder;
}
/// <summary>
......
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