Added prefixing for method params that have the same name as a C# keyword

This commit is contained in:
daver32
2022-01-28 12:01:02 +01:00
parent fe8c4ddd1b
commit 45a4369acd
3 changed files with 156 additions and 1 deletions
@@ -31,6 +31,24 @@ namespace InterfaceGenerator.Tests
_sut.VoidMethod();
}
[Fact]
public void VoidMethodWithKeywordParam_IsImplemented()
{
var method = typeof(IMethodsTestService).GetMethod(
nameof(MethodsTestService.VoidMethodWithKeywordParam));
method.Should().NotBeNull();
method.ReturnType.Should().Be(typeof(void));
var parameters = method.GetParameters();
parameters.Select(x => x.ParameterType).Should().AllBeEquivalentTo(typeof(string));
parameters.Should().HaveCount(1);
parameters[0].Name.Should().Be("void");
_sut.VoidMethodWithKeywordParam("");
}
[Fact]
public void VoidMethodWithParams_IsImplemented()
{
@@ -257,6 +275,10 @@ namespace InterfaceGenerator.Tests
public void VoidMethodWithParams(string a, string b)
{
}
public void VoidMethodWithKeywordParam(string @void)
{
}
public void VoidMethodWithOutParam(out string a)
{