-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new ITs for a multi-target solution
- Loading branch information
Amaury Levé
committed
Nov 23, 2017
1 parent
1951d0c
commit 092e19f
Showing
6 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
its/projects/MultiTargetConsoleApp/MultiTargetConsoleApp.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27004.2009 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiTargetConsoleApp", "MultiTargetConsoleApp\MultiTargetConsoleApp.csproj", "{9D7FB932-3B1E-446D-9D34-A63410458B88}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9D7FB932-3B1E-446D-9D34-A63410458B88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9D7FB932-3B1E-446D-9D34-A63410458B88}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9D7FB932-3B1E-446D-9D34-A63410458B88}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9D7FB932-3B1E-446D-9D34-A63410458B88}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {13A8E4AE-D696-4779-8C1B-6AEF70A70004} | ||
EndGlobalSection | ||
EndGlobal |
8 changes: 8 additions & 0 deletions
8
its/projects/MultiTargetConsoleApp/MultiTargetConsoleApp/MultiTargetConsoleApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp2.0;net46;net40</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
</Project> |
23 changes: 23 additions & 0 deletions
23
its/projects/MultiTargetConsoleApp/MultiTargetConsoleApp/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
|
||
namespace MultiTargetConsoleApp | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
int unusedVar = 42; | ||
|
||
Console.WriteLine("Hello World!"); | ||
#if NETCOREAPP2_0 | ||
Console.WriteLine("\tfrom .Net Core 2.0"); // FIXME: .Net Core 2 | ||
#elif NET46 | ||
Console.WriteLine("\tfrom .Net Fwk 4.6"); // FIXME: .Net fwk 4.6 | ||
#else | ||
Console.WriteLine("\tfrom other"); // FIXME: Other | ||
#endif | ||
|
||
Console.ReadKey(); | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
its/src/test/java/com/sonar/it/csharp/MultiTargetAppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* SonarSource :: C# :: ITs :: Plugin | ||
* Copyright (C) 2011-2017 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
package com.sonar.it.csharp; | ||
|
||
import org.junit.Before; | ||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.sonarqube.ws.Issues; | ||
|
||
import com.sonar.orchestrator.Orchestrator; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
import static com.sonar.it.csharp.Tests.getComponent; | ||
import static com.sonar.it.csharp.Tests.getIssues; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class MultiTargetAppTest { | ||
@Rule | ||
public TemporaryFolder temp = new TemporaryFolder(); | ||
|
||
@ClassRule | ||
public static final Orchestrator orchestrator = Tests.ORCHESTRATOR; | ||
|
||
@Before | ||
public void init() throws Exception { | ||
orchestrator.resetData(); | ||
} | ||
|
||
@Test | ||
public void should_analyze_multitarget_project() throws Exception { | ||
Path projectDir = Tests.projectDir(temp, "MultiTargetConsoleApp"); | ||
orchestrator.executeBuild(Tests.newScanner(projectDir) | ||
.addArgument("begin") | ||
.setProjectKey("MultiTargetConsoleApp") | ||
.setProjectName("MultiTargetConsoleApp") | ||
.setProjectVersion("1.0")); | ||
|
||
Tests.runNuGet(orchestrator, projectDir, "restore"); | ||
Tests.runMSBuild(orchestrator, projectDir, "/t:Rebuild"); | ||
|
||
orchestrator.executeBuild(Tests.newScanner(projectDir) | ||
.addArgument("end")); | ||
|
||
assertThat(getComponent("MultiTargetConsoleApp:MultiTargetConsoleApp:9D7FB932-3B1E-446D-9D34-A63410458B88:Program.cs")).isNotNull(); | ||
|
||
List<Issues.Issue> issues = getIssues("MultiTargetConsoleApp:MultiTargetConsoleApp:9D7FB932-3B1E-446D-9D34-A63410458B88:Program.cs"); | ||
assertThat(issues).hasSize(4); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters