Skip to content

Commit

Permalink
Update the test to test both code actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Sep 30, 2020
1 parent f7df990 commit 2db806b
Showing 1 changed file with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ namespace Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.Microsoft.CodeQuality.An
{
public class AssigningSymbolAndItsMemberInSameStatementFixerTests
{
[Fact]
public async Task CA2246CSharpCodeFixTestSplitUnobviousAssignment()
[Theory]
[InlineData(0, "a.Field = b;")]
[InlineData(1, "a.Field = a;")]
public async Task CA2246CSharpCodeFixTestSplitUnobviousAssignment(int codeActionIndex, string fix)
{
await VerifyCS.VerifyCodeFixAsync(@"
var code = @"
public class C
{
public C Field;
Expand All @@ -28,24 +30,30 @@ public void Method()
[|a.Field|] = a = b;
}
}
",
@"
";
var fixedCode = $@"
public class C
{
{{
public C Field;
}
}}
public class Test
{
{{
public void Method()
{
{{
C a = new C();
C b = new C();
a = b;
a.Field = b;
}
}
");
{fix}
}}
}}
";
await new VerifyCS.Test
{
TestState = { Sources = { code } },
FixedState = { Sources = { fixedCode } },
CodeActionIndex = codeActionIndex,
}.RunAsync();
}
}
}

0 comments on commit 2db806b

Please sign in to comment.