forked from icsharpcode/CodeConverter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensionMethodRefPropertyTests.cs
More file actions
61 lines (57 loc) · 1.36 KB
/
ExtensionMethodRefPropertyTests.cs
File metadata and controls
61 lines (57 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Threading.Tasks;
using Xunit;
namespace ICSharpCode.CodeConverter.Tests.VB;
public class ExtensionMethodRefPropertyTests : TestRunners.ConverterTestBase
{
[Fact]
public async Task TestExtensionMethodRefPropertyAsync()
{
await TestConversionVisualBasicToCSharpAsync(
@"Imports System.Runtime.CompilerServices
Public Class ExtensionMethodsRefPropertyParameter
Public Property Number As Integer = 3
Public Sub WithExtensionMethod()
Number.NegEx()
End Sub
Public Sub WithMethod()
Neg(Number)
End Sub
End Class
Public Module MathEx
<Extension()>
Public Sub NegEx(ByRef num As Integer)
num = -num
End Sub
Public Sub Neg(ByRef num As Integer)
num = -num
End Sub
End Module", @"
public partial class ExtensionMethodsRefPropertyParameter
{
public int Number { get; set; } = 3;
public void WithExtensionMethod()
{
int argnum = Number;
argnum.NegEx();
Number = argnum;
}
public void WithMethod()
{
int argnum = Number;
MathEx.Neg(ref argnum);
Number = argnum;
}
}
public static partial class MathEx
{
public static void NegEx(this ref int num)
{
num = -num;
}
public static void Neg(ref int num)
{
num = -num;
}
}", incompatibleWithAutomatedCommentTesting: true);
}
}