Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
porting more unit tests to .netcore project
- Loading branch information
DV
committed
Oct 24, 2019
1 parent
f47487f
commit b6d58e9
Showing
5 changed files
with
412 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System.Collections.Generic; | ||
using Jose; | ||
using Xunit; | ||
|
||
namespace UnitTests | ||
{ | ||
public class CollectionsTest | ||
{ | ||
[Fact] | ||
public void UnionArrays() | ||
{ | ||
var src = new[] {"one", "two"}; | ||
var other = new[] {"two", "three"}; | ||
|
||
Assert.Equal(Collections.Union(src, other), new [] {"one", "two", "three"}); | ||
} | ||
|
||
[Fact] | ||
public void UnionArrayList() | ||
{ | ||
var src = new[] { "one", "two" }; | ||
var other = new List<string>(new [] { "two", "three" }); | ||
|
||
Assert.Equal(Collections.Union(src, other), new[] { "one", "two", "three" }); | ||
|
||
} | ||
|
||
[Fact] | ||
public void UnionArraySet() | ||
{ | ||
var src = new[] { "one", "two" }; | ||
var other = new HashSet<string>(new [] { "two", "three" }); | ||
|
||
Assert.Equal(Collections.Union(src, other), new[] { "one", "two", "three" }); | ||
|
||
} | ||
|
||
[Fact] | ||
public void UnionNonStrings() | ||
{ | ||
var src = new[] { "one", "two" }; | ||
var other = new[] { 2, 3 }; | ||
|
||
Assert.Equal(Collections.Union(src, other), new[] { "one", "two", "2", "3" }); | ||
} | ||
|
||
[Fact] | ||
public void UnionNull() | ||
{ | ||
var other = new[] { "two", "three" }; | ||
|
||
Assert.Equal(Collections.Union(null, other), new[] { "two", "three" }); | ||
} | ||
|
||
[Fact] | ||
public void UnionWithNonEnumerable() | ||
{ | ||
var src = new[] { "one", "two" }; | ||
var other = 3; | ||
|
||
Assert.Equal(Collections.Union(src, other), new[] { "one", "two" }); | ||
} | ||
|
||
[Fact] | ||
public void UnionWithNull() | ||
{ | ||
var src = new[] { "one", "two" }; | ||
|
||
Assert.Equal(Collections.Union(src, null), new[] { "one", "two" }); | ||
} | ||
|
||
} | ||
} |
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
Oops, something went wrong.