-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port to xunit and other package updates
- Loading branch information
1 parent
b028306
commit 49b1d5e
Showing
4 changed files
with
440 additions
and
367 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
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
46 changes: 25 additions & 21 deletions
46
tests/DNX.Extensions.Tests/Enumerations/EnumerableExtensionsTests.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 |
---|---|---|
@@ -1,39 +1,43 @@ | ||
using DNX.Extensions.Enumerations; | ||
using NUnit.Framework; | ||
using DNX.Extensions.Enumerations; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace DNX.Extensions.Tests.Enumerations | ||
{ | ||
[TestFixture] | ||
public class EnumerableExtensionsTests | ||
{ | ||
[TestCase("", ExpectedResult = false)] | ||
[TestCase(null, ExpectedResult = false)] | ||
[TestCase("a,b,c,d,e,f,g,h,i,j", ExpectedResult = true)] | ||
public bool Test_HasAny(string commaDelimitedArray) | ||
[Theory] | ||
[InlineData("", false)] | ||
[InlineData(null, false)] | ||
[InlineData("a,b,c,d,e,f,g,h,i,j", true)] | ||
public void Test_HasAny(string commaDelimitedArray, bool expectedResult) | ||
{ | ||
var enumerable = commaDelimitedArray == null | ||
? null | ||
: commaDelimitedArray.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); | ||
var enumerable = commaDelimitedArray? | ||
.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); | ||
|
||
// Act | ||
var result = enumerable.HasAny(); | ||
|
||
return result; | ||
// Assert | ||
result.Should().Be(expectedResult); | ||
} | ||
|
||
[TestCase("", "1", ExpectedResult = false)] | ||
[TestCase(null, "1", ExpectedResult = false)] | ||
[TestCase("a1,b2,c1,d2,e1,f2,g1,h2,i1,j2", "1", ExpectedResult = true)] | ||
[TestCase("a1,b2,c1,d2,e1,f2,g1,h2,i1,j2", "2", ExpectedResult = true)] | ||
[TestCase("a1,b2,c1,d2,e1,f2,g1,h2,i1,j2", "0", ExpectedResult = false)] | ||
public bool Test_HasAny_predicate(string commaDelimitedArray, string suffix) | ||
[Theory] | ||
[InlineData("", "1", false)] | ||
[InlineData(null, "1", false)] | ||
[InlineData("a1,b2,c1,d2,e1,f2,g1,h2,i1,j2", "1", true)] | ||
[InlineData("a1,b2,c1,d2,e1,f2,g1,h2,i1,j2", "2", true)] | ||
[InlineData("a1,b2,c1,d2,e1,f2,g1,h2,i1,j2", "0", false)] | ||
public void Test_HasAny_predicate(string commaDelimitedArray, string suffix, bool expectedResult) | ||
{ | ||
var enumerable = commaDelimitedArray == null | ||
? null | ||
: commaDelimitedArray.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); | ||
var enumerable = commaDelimitedArray? | ||
.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); | ||
|
||
// Act | ||
var result = enumerable.HasAny(s => s.EndsWith(suffix)); | ||
|
||
return result; | ||
// Assert | ||
result.Should().Be(expectedResult); | ||
} | ||
} | ||
} |
Oops, something went wrong.