Skip to content

Commit c159ec2

Browse files
Some more tests
1 parent c0987df commit c159ec2

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

Tests/CSharp/MemberTests/MemberTests.cs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,62 @@ public partial class FooBar : IFoo, IBar
22112211
}");
22122212
}
22132213

2214+
[Fact]
2215+
public async Task ExplicitInterfaceImplementationRequiredMethodParameters_749_Async()
2216+
{
2217+
await TestConversionVisualBasicToCSharpAsync(
2218+
@"
2219+
Public Interface IFoo
2220+
Function DoFooBar(ByRef str As String, i As Integer) As Integer
2221+
End Interface
2222+
2223+
Public Interface IBar
2224+
Function DoFooBar(ByRef str As String, i As Integer) As Integer
2225+
End Interface
2226+
2227+
Public Class FooBar
2228+
Implements IFoo, IBar
2229+
2230+
Function Foo(ByRef str As String, i As Integer) As Integer Implements IFoo.DoFooBar
2231+
Return 4
2232+
End Function
2233+
2234+
Function Bar(ByRef str As String, i As Integer) As Integer Implements IBar.DoFooBar
2235+
Return 2
2236+
End Function
2237+
2238+
End Class", @"
2239+
public partial interface IFoo
2240+
{
2241+
int DoFooBar(ref string str, int i);
2242+
}
2243+
2244+
public partial interface IBar
2245+
{
2246+
int DoFooBar(ref string str, int i);
2247+
}
2248+
2249+
public partial class FooBar : IFoo, IBar
2250+
{
2251+
2252+
public int Foo(ref string str, int i)
2253+
{
2254+
return 4;
2255+
}
2256+
2257+
int IFoo.DoFooBar(ref string str, int i) => Foo(ref str, i);
2258+
2259+
public int Bar(ref string str, int i)
2260+
{
2261+
return 2;
2262+
}
2263+
2264+
int IBar.DoFooBar(ref string str, int i) => Bar(ref str, i);
2265+
2266+
}
2267+
");
2268+
}
2269+
22142270
[Fact]
22152271
public async Task ExplicitInterfaceImplementationOptionalParameters_1062_Async()
22162272
{
@@ -2297,6 +2353,63 @@ private void set_ExplicitProp(string str = """", int value = default)
22972353
");
22982354
}
22992355

2356+
2357+
[Fact]
2358+
public async Task ExplicitInterfaceImplementationOptionalMethodParameters_749_Async()
2359+
{
2360+
await TestConversionVisualBasicToCSharpAsync(
2361+
@"
2362+
Public Interface IFoo
2363+
Function DoFooBar(ByRef str As String, Optional i As Integer = 4) As Integer
2364+
End Interface
2365+
2366+
Public Interface IBar
2367+
Function DoFooBar(ByRef str As String, Optional i As Integer = 8) As Integer
2368+
End Interface
2369+
2370+
Public Class FooBar
2371+
Implements IFoo, IBar
2372+
2373+
Function Foo(ByRef str As String, Optional i As Integer = 4) As Integer Implements IFoo.DoFooBar
2374+
Return 4
2375+
End Function
2376+
2377+
Function Bar(ByRef str As String, Optional i As Integer = 8) As Integer Implements IBar.DoFooBar
2378+
Return 2
2379+
End Function
2380+
2381+
End Class", @"
2382+
public partial interface IFoo
2383+
{
2384+
int DoFooBar(ref string str, int i = 4);
2385+
}
2386+
2387+
public partial interface IBar
2388+
{
2389+
int DoFooBar(ref string str, int i = 8);
2390+
}
2391+
2392+
public partial class FooBar : IFoo, IBar
2393+
{
2394+
2395+
public int Foo(ref string str, int i = 4)
2396+
{
2397+
return 4;
2398+
}
2399+
2400+
int IFoo.DoFooBar(ref string str, int i = 4) => Foo(ref str, i);
2401+
2402+
public int Bar(ref string str, int i = 8)
2403+
{
2404+
return 2;
2405+
}
2406+
2407+
int IBar.DoFooBar(ref string str, int i = 8) => Bar(ref str, i);
2408+
2409+
}
2410+
");
2411+
}
2412+
23002413
[Fact]
23012414
public async Task RenamedInterfaceMethodFullyQualifiedAsync()
23022415
{

0 commit comments

Comments
 (0)