@Test public void execute_command_with_dot_net_core() { ScannerForMSBuild build = ScannerForMSBuild.create() .setProjectDir(new File(".")) .setProjectKey("SAMPLE") .setProjectName("Name") .setTimeoutSeconds(30) .setUseDotNetCore(true) .setScannerVersion("4.1.0.1148"); ScannerForMSBuildInstaller installer = mock(ScannerForMSBuildInstaller.class); when(installer.install(eq(Version.create("4.1.0.1148")), eq(null), any(File.class), eq(true))).thenReturn(new File("SonarScanner.MSBuild.dll")); CommandExecutor executor = mock(CommandExecutor.class); when(executor.execute(any(Command.class), any(StreamConsumer.class), anyLong())).thenReturn(2); new ScannerForMSBuildExecutor().execute(build, Configuration.create(), new HashMap<>(), installer, executor); verify(executor).execute(argThat(c -> { String commandLine = c.toCommandLine(); return c.getDirectory().equals(new File(".")) && commandLine.startsWith("dotnet") && commandLine.contains("SonarScanner.MSBuild.dll") && commandLine.contains("/k:SAMPLE") && commandLine.contains("/n:Name"); }), any(StreamConsumer.class), eq(30000L)); }
@Override BuildResult execute(ScannerForMSBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new ScannerForMSBuildInstaller(config.locators()), create); }
ScannerForMSBuildExecutor extends AbstractBuildExecutor<ScannerForMSBuild> { @Override BuildResult execute(ScannerForMSBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new ScannerForMSBuildInstaller(config.locators()), create); } }
ScannerForMSBuildExecutor extends AbstractBuildExecutor<ScannerForMSBuild> { @Override BuildResult execute(ScannerForMSBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new ScannerForMSBuildInstaller(config.locators()), create); }  }
ScannerForMSBuildExecutor extends AbstractBuildExecutor<ScannerForMSBuild> { @Override BuildResult execute(ScannerForMSBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new ScannerForMSBuildInstaller(config.locators()), create); }  static void addProp(Command c, String key, String value); }
ScannerForMSBuildExecutor extends AbstractBuildExecutor<ScannerForMSBuild> { @Override BuildResult execute(ScannerForMSBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new ScannerForMSBuildInstaller(config.locators()), create); }  static void addProp(Command c, String key, String value);  }