Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Microsoft.CodeAnalysis.Testing 1.1.0-beta1.21322.2 #54302

Merged
merged 4 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<!-- Versions used by several individual references below -->
<RoslynDiagnosticsNugetPackageVersion>3.3.3-beta1.21105.3</RoslynDiagnosticsNugetPackageVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0-preview1.21054.10</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisTestingVersion>1.0.1-beta1.20623.3</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftCodeAnalysisTestingVersion>1.1.0-beta1.21322.2</MicrosoftCodeAnalysisTestingVersion>
<CodeStyleAnalyzerVersion>3.10.0</CodeStyleAnalyzerVersion>
<VisualStudioEditorPackagesVersion>16.10.230</VisualStudioEditorPackagesVersion>
<ILAsmPackageVersion>5.0.0-alpha1.19409.1</ILAsmPackageVersion>
Expand Down
11 changes: 5 additions & 6 deletions src/CodeStyle/CSharp/Tests/FormattingAnalyzerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,15 @@ void MyMethod()

await new CSharpCodeFixTest<CSharpFormattingAnalyzer, CSharpFormattingCodeFixProvider, XUnitVerifier>
{
TestState = { Sources = { (Path.GetFullPath("Test0.cs"), testCode) } },
FixedState = { Sources = { (Path.GetFullPath("Test0.cs"), fixedCode) } },
SolutionTransforms =
TestState =
{
(solution, projectId) =>
Sources = { testCode },
AnalyzerConfigFiles =
{
var documentId = DocumentId.CreateNewId(projectId, ".editorconfig");
return solution.AddAnalyzerConfigDocument(documentId, ".editorconfig", SourceText.From(editorConfig, Encoding.UTF8), filePath: Path.GetFullPath(".editorconfig"));
("/.editorconfig", editorConfig),
},
},
FixedState = { Sources = { fixedCode } },
}.RunAsync();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Compile Include="..\..\..\EditorFeatures\DiagnosticsTestUtilities\CodeActions\CSharpCodeRefactoringVerifier`1+Test.cs" Link="CSharpCodeRefactoringVerifier`1+Test.cs" />
<Compile Include="..\..\..\EditorFeatures\DiagnosticsTestUtilities\CodeActions\CSharpCodeRefactoringVerifier`1.cs" Link="CSharpCodeRefactoringVerifier`1.cs" />
<Compile Include="..\..\..\EditorFeatures\DiagnosticsTestUtilities\CodeActions\CSharpVerifierHelper.cs" Link="CSharpVerifierHelper.cs" />
<Compile Include="..\..\..\EditorFeatures\DiagnosticsTestUtilities\CodeActions\SharedVerifierState.cs" Link="SharedVerifierState.cs" />
<Compile Include="..\..\..\EditorFeatures\DiagnosticsTestUtilities\CodeActions\VisualBasicCodeFixVerifier`2+Test.cs" Link="VisualBasicCodeFixVerifier`2+Test.cs" />
<Compile Include="..\..\..\EditorFeatures\DiagnosticsTestUtilities\CodeActions\VisualBasicCodeFixVerifier`2.cs" Link="VisualBasicCodeFixVerifier`2.cs" />
<Compile Include="..\..\..\EditorFeatures\DiagnosticsTestUtilities\CodeActions\VisualBasicCodeRefactoringVerifier`1+Test.cs" Link="VisualBasicCodeRefactoringVerifier`1+Test.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ private static async Task TestAsync(
if (index != 0)
Assert.NotNull(equivalenceKey);

var test = new VerifyCS.Test
options ??= new OptionsCollection(LanguageNames.CSharp);

await new VerifyCS.Test
{
TestCode = text,
FixedCode = expected,
Expand All @@ -57,11 +59,8 @@ private static async Task TestAsync(
CodeActionIndex = index,
CodeActionEquivalenceKey = equivalenceKey,
ExactActionSetOffered = actions,
};

if (options != null)
test.Options.AddRange(options);
await test.RunAsync();
Options = { options },
}.RunAsync();
}

#region update containing member tests
Expand Down Expand Up @@ -2278,7 +2277,8 @@ public static implicit operator NewStruct((int a, int a) value)
return new NewStruct(value.a, value.a);
}
}";
var test = new VerifyCS.Test

await new VerifyCS.Test
{
TestCode = text,
FixedCode = expected,
Expand Down Expand Up @@ -2349,11 +2349,9 @@ public static implicit operator NewStruct((int a, int a) value)
// /0/Test0.cs(49,45): error CS0229: Ambiguity between '(int a, int a).a' and '(int a, int a).a'
DiagnosticResult.CompilerError("CS0229").WithSpan(49, 45, 49, 46).WithArguments("(int a, int a).a", "(int a, int a).a"),
}
}
};

test.Options.AddRange(PreferImplicitTypeWithInfo());
await test.RunAsync();
},
Options = { PreferImplicitTypeWithInfo() },
}.RunAsync();
}

[Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.CodeActionsConvertTupleToStruct)]
Expand Down Expand Up @@ -3352,7 +3350,7 @@ void Goo()
}
}";

var test = new VerifyCS.Test
await new VerifyCS.Test
{
TestState =
{
Expand All @@ -3373,10 +3371,8 @@ void Goo()
CodeActionIndex = 1,
CodeActionEquivalenceKey = Scope.ContainingType.ToString(),
TestHost = host,
};

test.Options.AddRange(PreferImplicitTypeWithInfo());
await test.RunAsync();
Options = { PreferImplicitTypeWithInfo() },
}.RunAsync();
}

#endregion update containing project tests
Expand Down Expand Up @@ -3511,7 +3507,7 @@ void Goo()
}
}";

var test = new VerifyCS.Test
await new VerifyCS.Test
{
CodeActionIndex = 2,
CodeActionEquivalenceKey = Scope.ContainingProject.ToString(),
Expand All @@ -3524,10 +3520,8 @@ void Goo()
{
Sources = { expected1, expected2 },
},
};

test.Options.AddRange(PreferImplicitTypeWithInfo());
await test.RunAsync();
Options = { PreferImplicitTypeWithInfo() },
}.RunAsync();
}

#endregion
Expand Down Expand Up @@ -3638,7 +3632,7 @@ void Goo()
}
}";

var test = new VerifyCS.Test
await new VerifyCS.Test
{
CodeActionIndex = 3,
CodeActionEquivalenceKey = Scope.DependentProjects.ToString(),
Expand Down Expand Up @@ -3667,10 +3661,8 @@ void Goo()
}
},
},
};

test.Options.AddRange(PreferImplicitTypeWithInfo());
await test.RunAsync();
Options = { PreferImplicitTypeWithInfo() },
}.RunAsync();
}

[Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.CodeActionsConvertTupleToStruct)]
Expand Down Expand Up @@ -3777,7 +3769,7 @@ void Goo()
}
}";

var test = new VerifyCS.Test
await new VerifyCS.Test
{
CodeActionIndex = 3,
CodeActionEquivalenceKey = Scope.DependentProjects.ToString(),
Expand All @@ -3798,10 +3790,8 @@ void Goo()
["DependencyProject"] = { Sources = { expected2 } }
},
},
};

test.Options.AddRange(PreferImplicitTypeWithInfo());
await test.RunAsync();
Options = { PreferImplicitTypeWithInfo() },
}.RunAsync();
}

#endregion
Expand Down
Loading