|
@@ -31,6 +31,7 @@
|
|
|
#endregion
|
|
|
|
|
|
using Google.Protobuf.Reflection;
|
|
|
+using Google.Protobuf.TestProtos;
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
using NUnit.Framework;
|
|
|
using System.IO;
|
|
@@ -202,6 +203,21 @@ namespace Google.Protobuf.Test.Reflection
|
|
|
AssertOption(new Aggregate { S = "FieldAnnotation" }, fieldOptions.TryGetMessage, AggregateFieldOpt);
|
|
|
}
|
|
|
|
|
|
+ [Test]
|
|
|
+ public void NoOptions()
|
|
|
+ {
|
|
|
+ var fileDescriptor = UnittestProto3Reflection.Descriptor;
|
|
|
+ var messageDescriptor = TestAllTypes.Descriptor;
|
|
|
+ Assert.NotNull(fileDescriptor.CustomOptions);
|
|
|
+ Assert.NotNull(messageDescriptor.CustomOptions);
|
|
|
+ Assert.NotNull(messageDescriptor.Fields[1].CustomOptions);
|
|
|
+ Assert.NotNull(fileDescriptor.Services[0].CustomOptions);
|
|
|
+ Assert.NotNull(fileDescriptor.Services[0].Methods[0].CustomOptions);
|
|
|
+ Assert.NotNull(fileDescriptor.EnumTypes[0].CustomOptions);
|
|
|
+ Assert.NotNull(fileDescriptor.EnumTypes[0].Values[0].CustomOptions);
|
|
|
+ Assert.NotNull(TestAllTypes.Descriptor.Oneofs[0].CustomOptions);
|
|
|
+ }
|
|
|
+
|
|
|
private void AssertOption<T>(T expected, OptionFetcher<T> fetcher, CustomOptionNumber field)
|
|
|
{
|
|
|
T actual;
|