-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: release note highlighted when a pull request has the label
- Loading branch information
Showing
4 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/PullRequestReleaseNotes.Tests/Models/PullRequestDtoTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using PullRequestReleaseNotes.Models; | ||
using Shouldly; | ||
|
||
namespace PullRequestReleaseNotes.Tests.Models | ||
{ | ||
[TestFixture] | ||
public class PullRequestDtoTests | ||
{ | ||
[TestCase("a,b,c,h", "h", false)] | ||
[TestCase("a,b,c", "h", true)] | ||
[TestCase("a,b,c,h", "h,a", false)] | ||
public void Highlight(string labels, string highlightWhenMissing, bool highlight) | ||
{ | ||
var dto = new PullRequestDto | ||
{ | ||
Labels = Split(labels) | ||
}; | ||
|
||
dto.Highlighted(Split(highlightWhenMissing)).ShouldBe(highlight); | ||
} | ||
|
||
private static List<string> Split(string str) | ||
{ | ||
return str.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters