提交 50dc3310 编写于 作者: C Cyrus Najmabadi

Expanding tests.

上级 45be6e52
......@@ -584,6 +584,38 @@ int M()
}");
}
[WorkItem(27960, "https://github.com/dotnet/roslyn/issues/27960")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseConditionalExpression)]
public async Task TestOnYieldReturn_IEnumerableReturnType()
{
await TestInRegularAndScriptAsync(
@"
using System.Collections.Generic;
class C
{
IEnumerable<int> M()
{
[||]if (true)
{
yield return 0;
}
else
{
yield return 1;
}
}
}",
@"
class C
{
int M()
{
yield return true ? 0 : 1;
}
}");
}
[WorkItem(27960, "https://github.com/dotnet/roslyn/issues/27960")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseConditionalExpression)]
public async Task TestNotOnMixedYields()
......@@ -606,6 +638,30 @@ int M()
}");
}
[WorkItem(27960, "https://github.com/dotnet/roslyn/issues/27960")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseConditionalExpression)]
public async Task TestNotOnMixedYields_IEnumerableReturnType()
{
await TestMissingAsync(
@"
using System.Collections.Generic;
class C
{
IEnumerable<int> M()
{
[||]if (true)
{
yield break;
}
else
{
yield return 1;
}
}
}");
}
[WorkItem(27960, "https://github.com/dotnet/roslyn/issues/27960")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseConditionalExpression)]
public async Task TestNotWithNoElseBlockButFollowingYieldReturn()
......@@ -625,5 +681,27 @@ void M()
}
}");
}
[WorkItem(27960, "https://github.com/dotnet/roslyn/issues/27960")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseConditionalExpression)]
public async Task TestNotWithNoElseBlockButFollowingYieldReturn_IEnumerableReturnType()
{
await TestMissingAsync(
@"
using System.Collections.Generic;
class C
{
IEnumerable<int> M()
{
[||]if (true)
{
yield return 0;
}
yield return 1;
}
}");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册