diff --git a/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ASCATest.cs b/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ASCATest.cs index d3212bb..18b11d5 100644 --- a/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ASCATest.cs +++ b/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ASCATest.cs @@ -20,6 +20,7 @@ public void TestInstallAsca() agent: CxConstants.EXTENSION_AGENT ); Assert.NotNull(result); + Assert.Contains("asca engine is running successfully", result.Message); } diff --git a/ast-visual-studio-extension/CxWrapper/CxWrapper.cs b/ast-visual-studio-extension/CxWrapper/CxWrapper.cs index 597e479..994210f 100644 --- a/ast-visual-studio-extension/CxWrapper/CxWrapper.cs +++ b/ast-visual-studio-extension/CxWrapper/CxWrapper.cs @@ -37,24 +37,37 @@ public CxAsca ScanAsca(string fileSource, bool ascaLatestVersion = false, string { logger.Info(string.Format(CxConstants.LOG_RUNNING_ASCA_SCAN_CMD, fileSource)); - List arguments = new List - { - CxConstants.CLI_SCAN_CMD, - CxConstants.CLI_ASCA_CMD, - CxConstants.FLAG_FILE_SOURCE, - fileSource - }; + List arguments; - if (ascaLatestVersion) + if (string.IsNullOrWhiteSpace(fileSource)) + { + arguments = new List + { + CxConstants.CLI_SCAN_CMD, + CxConstants.CLI_ASCA_CMD, + CxConstants.FLAG_ASCA_LATEST_VERSION + }; + } + else { - arguments.Add(CxConstants.FLAG_ASCA_LATEST_VERSION); + arguments = new List + { + CxConstants.CLI_SCAN_CMD, + CxConstants.CLI_ASCA_CMD, + CxConstants.FLAG_FILE_SOURCE, + fileSource + }; + + if (ascaLatestVersion) + { + arguments.Add(CxConstants.FLAG_ASCA_LATEST_VERSION); + } } AppendAgentToArguments(agent, arguments); string result = Execution.ExecuteCommand(WithConfigArguments(arguments), Execution.CheckValidJSONString); return JsonConvert.DeserializeObject(result); - } ///