提交 507ba2dc 编写于 作者: D David Poeschl

Add test for SelectMany with identity lambda

上级 b153ad8d
......@@ -4,6 +4,7 @@
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeActions.ConvertLinq
{
......@@ -1327,6 +1328,44 @@ partial class C
await TestInRegularAndScriptAsync(source, linqInvocationOutput, index: 1);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertForEachToQuery)]
[WorkItem(31784, "https://github.com/dotnet/roslyn/issues/31784")]
public async Task QueryWhichRequiresSelectManyWithIdentityLambda()
{
var source = @"
using System.Collections.Generic;
class C
{
IEnumerable<int> M()
{
[|foreach (var x in new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 } })
{
foreach (var y in x)
{
yield return y;
}
}|]
}
}
";
var linqInvocationOutput = @"
using System.Collections.Generic;
using System.Linq;
class C
{
IEnumerable<int> M()
{
return (new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 } }).SelectMany(x => x);
}
}
";
await TestInRegularAndScriptAsync(source, linqInvocationOutput, index: 1);
}
#endregion
#region In foreach
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册