Skip to content

Commit

Permalink
Some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamTheCoder committed Dec 21, 2023
1 parent 82f8bb2 commit b0ba634
Showing 1 changed file with 113 additions and 0 deletions.
113 changes: 113 additions & 0 deletions Tests/CSharp/MemberTests/MemberTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,62 @@ public partial class FooBar : IFoo, IBar
}");
}

[Fact]
public async Task ExplicitInterfaceImplementationRequiredMethodParameters_749_Async()
{
await TestConversionVisualBasicToCSharpAsync(
@"
Public Interface IFoo
Function DoFooBar(ByRef str As String, i As Integer) As Integer
End Interface
Public Interface IBar
Function DoFooBar(ByRef str As String, i As Integer) As Integer
End Interface
Public Class FooBar
Implements IFoo, IBar
Function Foo(ByRef str As String, i As Integer) As Integer Implements IFoo.DoFooBar
Return 4
End Function
Function Bar(ByRef str As String, i As Integer) As Integer Implements IBar.DoFooBar
Return 2
End Function
End Class", @"
public partial interface IFoo
{
int DoFooBar(ref string str, int i);
}
public partial interface IBar
{
int DoFooBar(ref string str, int i);
}
public partial class FooBar : IFoo, IBar
{
public int Foo(ref string str, int i)
{
return 4;
}
int IFoo.DoFooBar(ref string str, int i) => Foo(ref str, i);
public int Bar(ref string str, int i)
{
return 2;
}
int IBar.DoFooBar(ref string str, int i) => Bar(ref str, i);
}
");
}

[Fact]
public async Task ExplicitInterfaceImplementationOptionalParameters_1062_Async()
{
Expand Down Expand Up @@ -2297,6 +2353,63 @@ private void set_ExplicitProp(string str = """", int value = default)
");
}


[Fact]
public async Task ExplicitInterfaceImplementationOptionalMethodParameters_749_Async()
{
await TestConversionVisualBasicToCSharpAsync(
@"
Public Interface IFoo
Function DoFooBar(ByRef str As String, Optional i As Integer = 4) As Integer
End Interface
Public Interface IBar
Function DoFooBar(ByRef str As String, Optional i As Integer = 8) As Integer
End Interface
Public Class FooBar
Implements IFoo, IBar
Function Foo(ByRef str As String, Optional i As Integer = 4) As Integer Implements IFoo.DoFooBar
Return 4
End Function
Function Bar(ByRef str As String, Optional i As Integer = 8) As Integer Implements IBar.DoFooBar
Return 2
End Function
End Class", @"
public partial interface IFoo
{
int DoFooBar(ref string str, int i = 4);
}
public partial interface IBar
{
int DoFooBar(ref string str, int i = 8);
}
public partial class FooBar : IFoo, IBar
{
public int Foo(ref string str, int i = 4)
{
return 4;
}
int IFoo.DoFooBar(ref string str, int i = 4) => Foo(ref str, i);
public int Bar(ref string str, int i = 8)
{
return 2;
}
int IBar.DoFooBar(ref string str, int i = 8) => Bar(ref str, i);
}
");
}

[Fact]
public async Task RenamedInterfaceMethodFullyQualifiedAsync()
{
Expand Down

0 comments on commit b0ba634

Please sign in to comment.