@Test
  public void testToCommandForSolution() throws Exception {
    StyleCopCommandBuilder styleCopCommandBuilder = StyleCopCommandBuilder.createBuilder(solution);
    styleCopCommandBuilder.setDotnetSdkDirectory(new File("DotnetSdkDir"));
    styleCopCommandBuilder.setStyleCopFolder(new File("StyleCopDir"));
    styleCopCommandBuilder.setConfigFile(
        TestUtils.getResource("/Runner/Command/SimpleRules.StyleCop"));
    styleCopCommandBuilder.setReportFile(new File("target/sonar/report.xml"));
    Command command = styleCopCommandBuilder.toCommand();

    assertThat(command.getExecutable(), endsWith("MSBuild.exe"));
    String[] commands = command.getArguments().toArray(new String[] {});
    assertThat(commands[0], endsWith("solution"));
    assertThat(commands[1], is("/target:StyleCopLaunch"));
    assertThat(commands[2], is("/noconsolelogger"));
    assertThat(commands[3], endsWith("stylecop-msbuild.xml"));

    File report = new File("target/sonar/stylecop-msbuild.xml");
    assertTrue(report.exists());
    report.delete();
  }
 /**
  * Constructs a {@link StyleCopCommandBuilder} object for the given Visual Studio project.
  *
  * @param solution the solution that contains the VS project
  * @param project the VS project to analyse
  * @return a StyleCop builder for this project
  */
 public static StyleCopCommandBuilder createBuilder(
     VisualStudioSolution solution, VisualStudioProject project) {
   StyleCopCommandBuilder builder = createBuilder(solution);
   builder.vsProject = project;
   return builder;
 }
 /**
  * Constructs a {@link StyleCopCommandBuilder} object for the given Visual Studio solution.
  *
  * @param solution the solution to analyse
  * @return a StyleCop builder for this solution
  */
 public static StyleCopCommandBuilder createBuilder(VisualStudioSolution solution) {
   StyleCopCommandBuilder builder = new StyleCopCommandBuilder();
   builder.solution = solution;
   return builder;
 }
 @Test(expected = IllegalStateException.class)
 public void testWithUnexistingStyleCopConfigFile() throws Exception {
   StyleCopCommandBuilder styleCopCommandBuilder = StyleCopCommandBuilder.createBuilder(solution);
   styleCopCommandBuilder.toCommand();
 }