Browse Source

Improve test to make sure the extensions are actually loaded for CustomOptions

Sydney Acksman 5 years ago
parent
commit
cd11d5414f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs

+ 4 - 0
csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs

@@ -198,6 +198,10 @@ namespace Google.Protobuf.Test.Reflection
         public void MultipleImportOfSameFileWithExtension()
         public void MultipleImportOfSameFileWithExtension()
         {
         {
             var descriptor = ExtensionsCReflection.Descriptor;
             var descriptor = ExtensionsCReflection.Descriptor;
+            var foo = Foo.Descriptor;
+            var bar = Bar.Descriptor;
+            AssertOption("bar", foo.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, foo.GetOption);
+            AssertOption("foo", bar.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, bar.GetOption);
         }
         }
 
 
         private void AssertOption<T, D>(T expected, OptionFetcher<T> fetcher, Extension<D, T> extension, Func<Extension<D, T>, T> descriptorOptionFetcher) where D : IExtendableMessage<D>
         private void AssertOption<T, D>(T expected, OptionFetcher<T> fetcher, Extension<D, T> extension, Func<Extension<D, T>, T> descriptorOptionFetcher) where D : IExtendableMessage<D>