Skip to content

Commit 9f2a65c

Browse files
committed
Changes from code review
1 parent c1dc9ec commit 9f2a65c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/NUnitCommon/nunit.agent.core/AgentOptions.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ public AgentOptions(params string[] args)
4949
val = option.Substring(delim + 1);
5050
}
5151

52-
if (!VALID_OPTIONS.ContainsKey(opt))
52+
// Simultaneously check that the option is valid and determine if it takes an argument
53+
if (!VALID_OPTIONS.TryGetValue(opt, out bool optionTakesValue))
5354
throw new Exception($"Invalid argument: {arg}");
5455

55-
bool optionTakesValue = VALID_OPTIONS[opt];
56-
5756
if (optionTakesValue)
5857
{
5958
if (val == null && index + 1 < args.Length)
@@ -119,7 +118,7 @@ string GetArgumentValue(string argument)
119118

120119
private static bool IsOption(string arg)
121120
{
122-
return arg.StartsWith("--");
121+
return arg.StartsWith("--", StringComparison.Ordinal);
123122
}
124123
}
125124
}

0 commit comments

Comments
 (0)