Skip to content

Commit

Permalink
Adding Before and After options
Browse files Browse the repository at this point in the history
Adding Before and After options for NUnit3Labels enum with tests.
  • Loading branch information
phillipsj committed Oct 24, 2017
1 parent 502640b commit 869b672
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
28 changes: 28 additions & 0 deletions src/Cake.Common.Tests/Unit/Tools/NUnit/NUnit3RunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,34 @@ public void Should_Not_Set_Switch_For_Default_Labels()
Assert.Equal("\"/Working/Test1.dll\"", result.Args);
}

[Fact]
public void Should_Set_Switch_For_After_Labels()
{
// Given
var fixture = new NUnit3RunnerFixture();
fixture.Settings.Labels = NUnit3Labels.After;

// When
var result = fixture.Run();

// Then
Assert.Equal("\"/Working/Test1.dll\" --labels=After", result.Args);
}

[Fact]
public void Should_Set_Switch_For_Before_Labels()
{
// Given
var fixture = new NUnit3RunnerFixture();
fixture.Settings.Labels = NUnit3Labels.Before;

// When
var result = fixture.Run();

// Then
Assert.Equal("\"/Working/Test1.dll\" --labels=Before", result.Args);
}

[Fact]
public void Should_Not_Set_Process_Switch_For_DefaultMultipleValue()
{
Expand Down
12 changes: 11 additions & 1 deletion src/Cake.Common/Tools/NUnit/NUnit3Labels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ public enum NUnit3Labels
/// <summary>
/// Outputs labels for all tests.
/// </summary>
All
All,

/// <summary>
/// Outputs labels at the start of every test.
/// </summary>
Before,

/// <summary>
/// Outputs labels at the end of every test.
/// </summary>
After
}
}
5 changes: 3 additions & 2 deletions src/Cake.Common/Tools/NUnit/NUnit3Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ public sealed class NUnit3Settings : ToolSettings
/// Gets or sets a value specifying whether to write test case names to the output.
/// </summary>
/// <value>
/// <c>On</c> to write labels for tests that are run or <c>All</c> to write labels
/// for all tests.
/// <c>On</c> to write labels for tests that are run,<c>All</c> to write labels
/// for all tests,<c>Before</c> to write labels at the start of every test
/// ,or <c>After</c> to write labels at the end of every test.
/// </value>
public NUnit3Labels Labels { get; set; }

Expand Down

0 comments on commit 869b672

Please sign in to comment.