Skip to content

Commit

Permalink
convert duplicated test code to parametrized test
Browse files Browse the repository at this point in the history
  • Loading branch information
szaliszali committed Jan 9, 2020
1 parent 5f2bace commit ea11ce4
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,10 @@ public void PreprocessSwitchIdentificationTests()
Assert.True(unquoteParameters);
}

[Fact]
public void TargetsSwitchIdentificationTests()
[Theory]
[InlineData("targets")]
[InlineData("ts")]
public void TargetsSwitchIdentificationTests(string @switch)
{
CommandLineSwitches.ParameterizedSwitch parameterizedSwitch;
string duplicateSwitchErrorMessage;
Expand All @@ -741,14 +743,7 @@ public void TargetsSwitchIdentificationTests()
bool unquoteParameters;
bool emptyParametersAllowed;

Assert.True(CommandLineSwitches.IsParameterizedSwitch("targets", out parameterizedSwitch, out duplicateSwitchErrorMessage, out multipleParametersAllowed, out missingParametersErrorMessage, out unquoteParameters, out emptyParametersAllowed));
Assert.Equal(CommandLineSwitches.ParameterizedSwitch.Targets, parameterizedSwitch);
Assert.Null(duplicateSwitchErrorMessage);
Assert.False(multipleParametersAllowed);
Assert.Null(missingParametersErrorMessage);
Assert.True(unquoteParameters);

Assert.True(CommandLineSwitches.IsParameterizedSwitch("ts", out parameterizedSwitch, out duplicateSwitchErrorMessage, out multipleParametersAllowed, out missingParametersErrorMessage, out unquoteParameters, out emptyParametersAllowed));
Assert.True(CommandLineSwitches.IsParameterizedSwitch(@switch, out parameterizedSwitch, out duplicateSwitchErrorMessage, out multipleParametersAllowed, out missingParametersErrorMessage, out unquoteParameters, out emptyParametersAllowed));
Assert.Equal(CommandLineSwitches.ParameterizedSwitch.Targets, parameterizedSwitch);
Assert.Null(duplicateSwitchErrorMessage);
Assert.False(multipleParametersAllowed);
Expand Down

0 comments on commit ea11ce4

Please sign in to comment.