提交 495658b9 编写于 作者: C CyrusNajmabadi

Add test for expressin bodied method.

上级 9d3f7a7c
......@@ -67,6 +67,20 @@ public async Task TestMethod()
@"using System; interface IInterface { void Method1 ( ) ; } class Class : IInterface { public void Method1 ( ) { throw new NotImplementedException ( ) ; } } ");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)]
public async Task TestExpressionBodiedMethod1()
{
await TestWithAllCodeStyleOptionsOnAsync(
@"interface IInterface { void Method1 ( ) ; } class Class : [|IInterface|] { } ",
@"using System;
interface IInterface {
void Method1 ( ) ;
}
class Class : IInterface {
public void Method1 ( ) => throw new NotImplementedException ( ) ;
}");
}
private static readonly string s_tupleElementNamesAttribute =
@"namespace System.Runtime.CompilerServices
{
......
......@@ -120,7 +120,8 @@ internal static class MethodGenerator
if (expressionBody != null)
{
return methodDeclaration.WithBody(null)
.WithExpressionBody(expressionBody);
.WithExpressionBody(expressionBody)
.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册