in src/Analyzer.Cli.FunctionalTests/CommandLineParserTests.cs [123:149]
public void AnalyzeTemplate_ValidInputValues_AnalyzesUsingCustomJSONRulesPath()
{
var rulesDir = Path.Combine(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
"Rules");
var rulesFile = Path.Combine(rulesDir, "BuiltInRules.json");
var customJSONRulesPath = Path.Combine(rulesDir, "MovedRules.json");
var templatePath = GetFilePath(Path.Combine("ToTestSeparateParametersFile", "TemplateWithSeparateParametersFile.bicep"));
var args = new string[] {
"analyze-template", templatePath,
"--custom-json-rules-path", customJSONRulesPath
};
// Move rules file
File.Move(rulesFile, customJSONRulesPath, overwrite: true);
try
{
var result = _commandLineParser.InvokeCommandLineAPIAsync(args);
Assert.AreEqual((int)ExitCode.Success, result.Result);
}
finally
{
File.Move(customJSONRulesPath, rulesFile, overwrite: true);
}
}