Skip to content

Commit

Permalink
Update Microsoft.CodeAnalysis.Testing to 1.0.1-beta1.20623.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Dec 29, 2020
1 parent f262c13 commit ec32196
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,20 @@ public async Task TestStatementSpacingInTopLevelProgramAsync()
await new CSharpTest(LanguageVersion.CSharp9)
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
TestCode = testCode,
ExpectedDiagnostics =
TestState =
{
// /0/Test0.cs(3,1): warning SA1516: Elements should be separated by blank line
Diagnostic().WithLocation(0),

// /0/Test0.cs(3,1): warning SA1516: Elements should be separated by blank line
Diagnostic().WithLocation(0),
},
FixedCode = fixedCode,
SolutionTransforms =
{
(solution, projectId) =>
OutputKind = OutputKind.ConsoleApplication,
Sources = { testCode },
ExpectedDiagnostics =
{
var project = solution.GetProject(projectId);
var options = project.CompilationOptions;
return solution.WithProjectCompilationOptions(projectId, options.WithOutputKind(OutputKind.ConsoleApplication));
// /0/Test0.cs(3,1): warning SA1516: Elements should be separated by blank line
Diagnostic().WithLocation(0),

// /0/Test0.cs(3,1): warning SA1516: Elements should be separated by blank line
Diagnostic().WithLocation(0),
},
},
FixedCode = fixedCode,
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ public async Task TestValidUsingStatementsInTopLevelProgramAsync()
await new CSharpTest(LanguageVersion.CSharp9)
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
TestCode = testCode,
Settings = TestSettings,
SolutionTransforms =
TestState =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
var options = project.CompilationOptions;
return solution.WithProjectCompilationOptions(projectId, options.WithOutputKind(OutputKind.ConsoleApplication));
},
OutputKind = OutputKind.ConsoleApplication,
Sources = { testCode },
},
Settings = TestSettings,
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ public async Task TestValidUsingStatementsInTopLevelProgramAsync()
await new CSharpTest(LanguageVersion.CSharp9)
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
TestCode = testCode,
Settings = TestSettings,
SolutionTransforms =
TestState =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
var options = project.CompilationOptions;
return solution.WithProjectCompilationOptions(projectId, options.WithOutputKind(OutputKind.ConsoleApplication));
},
OutputKind = OutputKind.ConsoleApplication,
Sources = { testCode },
},
Settings = TestSettings,
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ public async Task TestValidUsingStatementsInTopLevelProgramAsync()
await new CSharpTest(LanguageVersion.CSharp9)
{
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
TestCode = testCode,
SolutionTransforms =
TestState =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
var options = project.CompilationOptions;
return solution.WithProjectCompilationOptions(projectId, options.WithOutputKind(OutputKind.ConsoleApplication));
},
OutputKind = OutputKind.ConsoleApplication,
Sources = { testCode },
},
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,10 @@ public class Bar
// Verify that this works if the project was configured to treat documentation comments as regular comments
await new CSharpTest
{
TestCode = testCode,
SolutionTransforms =
TestState =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
return solution.WithProjectParseOptions(projectId, project.ParseOptions.WithDocumentationMode(DocumentationMode.None));
},
DocumentationMode = DocumentationMode.None,
Sources = { testCode },
},
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ public async Task TestEnabledDocumentationModesAsync(DocumentationMode documenta

await new CSharpTest
{
TestCode = testCode,
SolutionTransforms =
TestState =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
return solution.WithProjectParseOptions(projectId, project.ParseOptions.WithDocumentationMode(documentationMode));
},
DocumentationMode = documentationMode,
Sources = { testCode },
},
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
Expand All @@ -54,15 +50,11 @@ public async Task TestDisabledDocumentationModesAsync(DocumentationMode document

await new CSharpTest
{
TestCode = testCode,
ExpectedDiagnostics = { expected },
SolutionTransforms =
TestState =
{
(solution, projectId) =>
{
var project = solution.GetProject(projectId);
return solution.WithProjectParseOptions(projectId, project.ParseOptions.WithDocumentationMode(documentationMode));
},
DocumentationMode = documentationMode,
Sources = { testCode },
ExpectedDiagnostics = { expected },
},
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="1.3.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.0.1-beta1.20559.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.0.1-beta1.20623.3" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.1.8" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down

0 comments on commit ec32196

Please sign in to comment.