Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
yakovypg committed Aug 6, 2024
1 parent d0afcc0 commit 8a1e22b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ private static string GetDefaultMessage(string[] optionValue, string[] allowedVa
string allowedValuesPresenter = string.Join(", ", allowedValues);

return $"Option value '{optionValuePresenter}' not allowed. " +
$"It must be one of [{allowedValuesPresenter}].";
"It must be one of {" + allowedValuesPresenter + "}.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace NetArgumentParser.Options.Utils.Verifiers;

internal static partial class OptionNameCorrectnessVerifier
{
private static readonly List<string> _specialNames = [ "?" ];
private static readonly List<string> _reservedNames = [ "?" ];

internal static void VerifyAtLeastOneNameIsDefined(string longName, string shortName)
{
Expand All @@ -26,7 +26,7 @@ internal static void VerifyNameIsCorrect(string name)
ArgumentNullException.ThrowIfNull(name, nameof(name));

if (!string.IsNullOrEmpty(name)
&& !_specialNames.Contains(name)
&& !_reservedNames.Contains(name)
&& !CorrectNameRegex().IsMatch(name))
{
throw new IncorrectOptionNameException(null, name);
Expand Down
4 changes: 2 additions & 2 deletions Tests/NetArgumentParser.Tests/src/ArgumentParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1660,8 +1660,8 @@ private static void VerifyExtraArguments(
ArgumentNullException.ThrowIfNull(actual, nameof(expected));
ArgumentNullException.ThrowIfNull(actual, nameof(actual));

expected = expected.OrderBy(t => t);
actual = actual.OrderBy(t => t);
expected = expected.Order();
actual = actual.Order();

Assert.True(expected.SequenceEqual(actual));
}
Expand Down

0 comments on commit 8a1e22b

Please sign in to comment.