未验证 提交 9b3f5b50 编写于 作者: Y Youssef Victor 提交者: GitHub

Add tests

上级 6fca15c0
......@@ -2513,6 +2513,78 @@ internal void M()
}");
}
[WorkItem(48064, "https://github.com/dotnet/roslyn/issues/48064")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestInvocationWithinSynchronousForEach()
{
await TestInRegularAndScriptAsync(
@"class C
{
void M(ISomeInterface _someInterface)
{
foreach (var item in _someInterface.[|GetItems|]())
{
}
}
}
interface ISomeInterface
{
}",
@"using System.Collections.Generic;
class C
{
void M(ISomeInterface _someInterface)
{
foreach (var item in _someInterface.GetItems())
{
}
}
}
interface ISomeInterface
{
IEnumerable<object> GetItems();
}");
}
[WorkItem(48064, "https://github.com/dotnet/roslyn/issues/48064")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestInvocationWithinAsynchronousForEach()
{
await TestInRegularAndScriptAsync(
@"class C
{
async void M(ISomeInterface _someInterface)
{
await foreach (var item in _someInterface.[|GetItems|]())
{
}
}
}
interface ISomeInterface
{
}",
@"using System.Collections.Generic;
class C
{
async void M(ISomeInterface _someInterface)
{
await foreach (var item in _someInterface.GetItems())
{
}
}
}
interface ISomeInterface
{
IAsyncEnumerable<object> GetItems();
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestInvocationOffOfAnotherMethodCall()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册