public void ItEnforcesOptionRules(bool throws, params string[] options) { var parseResult = Parser.Instance.Parse($"dotnet list package {string.Join(' ', options)}"); Action checkRules = () => ListPackageReferencesCommand.EnforceOptionRules(parseResult); if (throws) { Assert.Throws <GracefulException>(checkRules); } else { checkRules(); // Test for no throw } }
public void ItEnforcesOptionRules(bool throws, params string[] options) { var parser = Parser.Instance; var parseResult = parser.ParseFrom($"dotnet list package", options); var appliedCommand = parseResult.AppliedCommand(); Action checkRules = () => ListPackageReferencesCommand.EnforceOptionRules(appliedCommand); if (throws) { Assert.Throws <GracefulException>(checkRules); } else { checkRules(); // Test for no throw } }