Skip to content

Commit b81754a

Browse files
author
dotnet-automerge-bot
authored
Merge pull request #27409 from dotnet/merges/master-to-features/embeddedJson
Merge master to features/embeddedJson
2 parents b649d3b + 5a65f66 commit b81754a

File tree

3 files changed

+744
-147
lines changed

3 files changed

+744
-147
lines changed

src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7730,6 +7730,206 @@ static void Main(string[] args)
77307730
Console.WriteLine(arg.[|NotFound|]());
77317731
});
77327732
}
7733+
}");
7734+
}
7735+
7736+
[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
7737+
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
7738+
public async Task TestGenerateMethodInExpressionBodiedGetter()
7739+
{
7740+
await TestInRegularAndScriptAsync(
7741+
@"class Class
7742+
{
7743+
int Property
7744+
{
7745+
get => [|GenerateMethod|]();
7746+
}
7747+
}",
7748+
@"using System;
7749+
7750+
class Class
7751+
{
7752+
int Property
7753+
{
7754+
get => GenerateMethod();
7755+
}
7756+
7757+
private int GenerateMethod()
7758+
{
7759+
throw new NotImplementedException();
7760+
}
7761+
}");
7762+
}
7763+
7764+
[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
7765+
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
7766+
public async Task TestGenerateMethodInExpressionBodiedSetter()
7767+
{
7768+
await TestInRegularAndScriptAsync(
7769+
@"class Class
7770+
{
7771+
int Property
7772+
{
7773+
set => [|GenerateMethod|](value);
7774+
}
7775+
}",
7776+
@"using System;
7777+
7778+
class Class
7779+
{
7780+
int Property
7781+
{
7782+
set => GenerateMethod(value);
7783+
}
7784+
7785+
private void GenerateMethod(int value)
7786+
{
7787+
throw new NotImplementedException();
7788+
}
7789+
}");
7790+
}
7791+
7792+
[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
7793+
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
7794+
public async Task TestGenerateMethodInExpressionBodiedLocalFunction()
7795+
{
7796+
await TestInRegularAndScriptAsync(
7797+
@"class Class
7798+
{
7799+
void Method()
7800+
{
7801+
int Local() => [|GenerateMethod()|];
7802+
}
7803+
}",
7804+
@"using System;
7805+
7806+
class Class
7807+
{
7808+
void Method()
7809+
{
7810+
int Local() => GenerateMethod();
7811+
}
7812+
7813+
private int GenerateMethod()
7814+
{
7815+
throw new NotImplementedException();
7816+
}
7817+
}");
7818+
}
7819+
7820+
[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
7821+
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
7822+
public async Task TestGenerateMethodInBlockBodiedLocalFunction()
7823+
{
7824+
await TestInRegularAndScriptAsync(
7825+
@"class Class
7826+
{
7827+
void Method()
7828+
{
7829+
int Local()
7830+
{
7831+
return [|GenerateMethod()|];
7832+
}
7833+
}
7834+
}",
7835+
@"using System;
7836+
7837+
class Class
7838+
{
7839+
void Method()
7840+
{
7841+
int Local()
7842+
{
7843+
return GenerateMethod();
7844+
}
7845+
}
7846+
7847+
private int GenerateMethod()
7848+
{
7849+
throw new NotImplementedException();
7850+
}
7851+
}");
7852+
}
7853+
7854+
[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
7855+
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
7856+
public async Task TestGenerateMethodInBlockBodiedLocalFunctionInsideLambdaExpression()
7857+
{
7858+
await TestInRegularAndScriptAsync(
7859+
@"
7860+
using System;
7861+
7862+
class Class
7863+
{
7864+
void Method()
7865+
{
7866+
Action action = () =>
7867+
{
7868+
int Local()
7869+
{
7870+
return [|GenerateMethod()|];
7871+
}
7872+
}
7873+
}
7874+
}",
7875+
@"
7876+
using System;
7877+
7878+
class Class
7879+
{
7880+
void Method()
7881+
{
7882+
Action action = () =>
7883+
{
7884+
int Local()
7885+
{
7886+
return GenerateMethod();
7887+
}
7888+
}
7889+
}
7890+
7891+
private int GenerateMethod()
7892+
{
7893+
throw new NotImplementedException();
7894+
}
7895+
}");
7896+
}
7897+
7898+
[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
7899+
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
7900+
public async Task TestGenerateMethodInExpressionBodiedLocalFunctionInsideLambdaExpression()
7901+
{
7902+
await TestInRegularAndScriptAsync(
7903+
@"
7904+
using System;
7905+
7906+
class Class
7907+
{
7908+
void Method()
7909+
{
7910+
Action action = () =>
7911+
{
7912+
int Local() => [|GenerateMethod()|];
7913+
}
7914+
}
7915+
}",
7916+
@"
7917+
using System;
7918+
7919+
class Class
7920+
{
7921+
void Method()
7922+
{
7923+
Action action = () =>
7924+
{
7925+
int Local() => GenerateMethod();
7926+
}
7927+
}
7928+
7929+
private int GenerateMethod()
7930+
{
7931+
throw new NotImplementedException();
7932+
}
77337933
}");
77347934
}
77357935
}

0 commit comments

Comments
 (0)