Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
elchananarb committed Dec 2, 2024
1 parent 0ca8f77 commit 8c7225f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void TestInstallAsca()
agent: CxConstants.EXTENSION_AGENT
);
Assert.NotNull(result);
Assert.Contains("asca engine is running successfully", result.Message);
}


Expand Down
33 changes: 23 additions & 10 deletions ast-visual-studio-extension/CxWrapper/CxWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> arguments = new List<string>
{
CxConstants.CLI_SCAN_CMD,
CxConstants.CLI_ASCA_CMD,
CxConstants.FLAG_FILE_SOURCE,
fileSource
};
List<string> arguments;

if (ascaLatestVersion)
if (string.IsNullOrWhiteSpace(fileSource))
{
arguments = new List<string>
{
CxConstants.CLI_SCAN_CMD,
CxConstants.CLI_ASCA_CMD,
CxConstants.FLAG_ASCA_LATEST_VERSION
};
}
else
{
arguments.Add(CxConstants.FLAG_ASCA_LATEST_VERSION);
arguments = new List<string>
{
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<CxAsca>(result);

}

/// <summary>
Expand Down

0 comments on commit 8c7225f

Please sign in to comment.