public void NoAsyncInternalWrapper() { var bgen = new BGenTool(); bgen.Profile = Profile.iOS; bgen.AddTestApiDefinition("noasyncinternalwrapper.cs"); bgen.CreateTemporaryBinding(); bgen.AssertExecute("build"); var allTypes = bgen.ApiAssembly.MainModule.GetTypes().ToArray(); var allMembers = ((IEnumerable <MemberReference>)allTypes) .Union(allTypes.SelectMany((type) => type.Methods)) .Union(allTypes.SelectMany((type) => type.Fields)) .Union(allTypes.SelectMany((type) => type.Properties)); Assert.AreEqual(1, allMembers.Count((member) => member.Name == "RequiredMethodAsync"), "Expected 1 RequiredMethodAsync members in generated code. If you modified code that generates RequiredMethodAsync (AsyncAttribute) please update the RequiredMethodAsync count."); var attribs = MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.HideBySig; bgen.AssertMethod("NoAsyncInternalWrapperTests.MyFooDelegate_Extensions", "RequiredMethodAsync", attribs, "System.Threading.Tasks.Task", "NoAsyncInternalWrapperTests.IMyFooDelegate", "System.Int32"); }
public void VirtualWrap() { var bgen = new BGenTool(); bgen.Profile = Profile.iOS; bgen.AddTestApiDefinition("virtualwrap.cs"); bgen.CreateTemporaryBinding(); bgen.ProcessEnums = true; bgen.AssertExecute("build"); // verify virtual methods var attribs = MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig | MethodAttributes.NewSlot; bgen.AssertMethod("WrapTest.MyFooClass", "FromUrl", attribs, null, "Foundation.NSUrl"); bgen.AssertMethod("WrapTest.MyFooClass", "FromUrl", attribs, null, "System.String"); bgen.AssertMethod("WrapTest.MyFooClass", "get_FooNSString", attribs | MethodAttributes.SpecialName, "Foundation.NSString"); bgen.AssertMethod("WrapTest.MyFooClass", "get_FooString", attribs | MethodAttributes.SpecialName, "System.String"); // verify non-virtual methods attribs = MethodAttributes.Public | MethodAttributes.HideBySig; bgen.AssertMethod("WrapTest.MyFooClass", "FromUrlN", attribs, null, "System.String"); bgen.AssertMethod("WrapTest.MyFooClass", "get_FooNSStringN", attribs | MethodAttributes.SpecialName, "Foundation.NSString"); }