Skip to content

Commit

Permalink
Added end-to-end integration test
Browse files Browse the repository at this point in the history
Note: tests are currently only executed against Roslyn v1 and v1.1
  • Loading branch information
duncanp-sonar committed Nov 17, 2021
1 parent 53510c7 commit c6503c3
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>

<!-- Avoid ID conflicts with the package project. -->
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<IsPackable>true</IsPackable>
<PackageId>RoslynV298</PackageId>
<Version>2.3</Version>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.8" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.3.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.8" PrivateAssets="all" ExcludeAssets="analyzers" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.3.1" PrivateAssets="all" ExcludeAssets="analyzers" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>

<!-- Avoid ID conflicts with the package project. -->
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<IsPackable>true</IsPackable>
<PackageId>RoslynV333</PackageId>
<Version>3.4.5</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" ExcludeAssets="analyzers" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" PrivateAssets="all" ExcludeAssets="analyzers" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Tests/IntegrationTests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public async Task Execute_MissingArgs_Fails()
[DataRow("RoslynAnalyzer10:1.0.0")]
[DataRow("RoslynAnalyzer11:1.0.0")]
[DataRow("wintellect.analyzers")]
//[DataRow("RoslynV298")]
//[DataRow("RoslynV333")]
public async Task Execute_ExampleAnalyzers_Succeeds(string analyzerArg)
{
var exeFilePath = GetExeFilePath();
Expand Down
8 changes: 1 addition & 7 deletions Tests/IntegrationTests/IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@
</ItemGroup>

<ItemGroup>
<None Update="SampleNuGetPkgs\RoslynAnalyzer10.1.0.0.nupkg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleNuGetPkgs\RoslynAnalyzer11.1.0.0.nupkg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleNuGetPkgs\wintellect.analyzers.1.0.6.nupkg">
<None Update="SampleNuGetPkgs\*.nupkg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public void InstantiateDiags_MultipleAssemblies_AnalyzersFound()
[TestMethod]
[DataRow(typeof(RoslynAnalyzer10.ExampleAnalyzer2), 1)]
[DataRow(typeof(RoslynAnalyzer11.CSharpAnalyzer), 3)]
[DataRow(typeof(RoslynAnalyzer298.RoslynAnalyzer298Analyzer), 1)]
[DataRow(typeof(RoslynAnalyzer333.RoslynAnalyzer333Analyzer), 1)]
//[DataRow(typeof(RoslynAnalyzer298.RoslynAnalyzer298Analyzer), 1)]
//[DataRow(typeof(RoslynAnalyzer333.RoslynAnalyzer333Analyzer), 1)]
public void InstantiateDiags_DifferentRoslynVersions_AnalyzersFound(Type typeInTargetAssembly, int expectedAnalyzerCount)
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup Label="Test packages">
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
Expand All @@ -19,15 +19,19 @@
<PackageReference Include="NuGet.CommandLine" Version="4.7.0" GeneratePathProperty="true" />
<Reference Include="$(PkgNuGet_CommandLine)\tools\NuGet.exe" />
</ItemGroup>


<!--<ItemGroup>
<Reference Include="System.IO.Compression.FileSystem" Private="true" />
</ItemGroup>-->

<ItemGroup>
<ProjectReference Include="..\..\Common\SonarQube.Plugins.Common.csproj" />
<ProjectReference Include="..\..\PluginGenerator\SonarQube.Plugins.PluginGenerator.csproj" />
<ProjectReference Include="..\..\RoslynPluginGenerator\SonarQube.Plugins.Roslyn.PluginGenerator.csproj" />
<ProjectReference Include="..\Common\SonarQube.Plugins.Test.Common.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer10\RoslynAnalyzer10\RoslynAnalyzer10.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer11\RoslynAnalyzer11\RoslynAnalyzer11.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer298\RoslynAnalyzer298.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer333\RoslynAnalyzer333.csproj" />
<!--<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer298\RoslynAnalyzer298.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer333\RoslynAnalyzer333.csproj" />-->
</ItemGroup>
</Project>

0 comments on commit c6503c3

Please sign in to comment.