|
@@ -210,142 +210,6 @@ namespace Tests
|
|
throw new Exception("Bang!");
|
|
throw new Exception("Bang!");
|
|
}
|
|
}
|
|
|
|
|
|
- [Fact]
|
|
|
|
- public void Union_Null()
|
|
|
|
- {
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(null, AsyncEnumerable.Return(42)));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(AsyncEnumerable.Return(42), null));
|
|
|
|
-
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(null, AsyncEnumerable.Return(42), new Eq()));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(AsyncEnumerable.Return(42), null, new Eq()));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Union<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Union1()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Union(ys);
|
|
|
|
-
|
|
|
|
- var e = res.GetAsyncEnumerator();
|
|
|
|
- HasNext(e, 1);
|
|
|
|
- HasNext(e, 2);
|
|
|
|
- HasNext(e, 3);
|
|
|
|
- HasNext(e, 5);
|
|
|
|
- HasNext(e, 4);
|
|
|
|
- NoNext(e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Union2()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Union(ys, new Eq());
|
|
|
|
-
|
|
|
|
- var e = res.GetAsyncEnumerator();
|
|
|
|
- HasNext(e, 1);
|
|
|
|
- HasNext(e, 2);
|
|
|
|
- HasNext(e, -3);
|
|
|
|
- HasNext(e, 5);
|
|
|
|
- HasNext(e, 4);
|
|
|
|
- NoNext(e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Intersect_Null()
|
|
|
|
- {
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(null, AsyncEnumerable.Return(42)));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(AsyncEnumerable.Return(42), null));
|
|
|
|
-
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(null, AsyncEnumerable.Return(42), new Eq()));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(AsyncEnumerable.Return(42), null, new Eq()));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Intersect<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Intersect1()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Intersect(ys);
|
|
|
|
-
|
|
|
|
- var e = res.GetAsyncEnumerator();
|
|
|
|
- HasNext(e, 1);
|
|
|
|
- HasNext(e, 3);
|
|
|
|
- NoNext(e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Intersect2()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Intersect(ys, new Eq());
|
|
|
|
-
|
|
|
|
- var e = res.GetAsyncEnumerator();
|
|
|
|
- HasNext(e, 1);
|
|
|
|
- HasNext(e, -3);
|
|
|
|
- NoNext(e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public async Task Intersect3()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Intersect(ys);
|
|
|
|
-
|
|
|
|
- await SequenceIdentity(res);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Except_Null()
|
|
|
|
- {
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(null, AsyncEnumerable.Return(42)));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(AsyncEnumerable.Return(42), null));
|
|
|
|
-
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(null, AsyncEnumerable.Return(42), new Eq()));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(AsyncEnumerable.Return(42), null, new Eq()));
|
|
|
|
- AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Except<int>(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Except1()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Except(ys);
|
|
|
|
-
|
|
|
|
- var e = res.GetAsyncEnumerator();
|
|
|
|
- HasNext(e, 2);
|
|
|
|
- NoNext(e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public void Except2()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Except(ys, new Eq());
|
|
|
|
-
|
|
|
|
- var e = res.GetAsyncEnumerator();
|
|
|
|
- HasNext(e, 2);
|
|
|
|
- NoNext(e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [Fact]
|
|
|
|
- public async Task Except3()
|
|
|
|
- {
|
|
|
|
- var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
|
|
|
|
- var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable();
|
|
|
|
- var res = xs.Except(ys);
|
|
|
|
-
|
|
|
|
- await SequenceIdentity(res);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
[Fact]
|
|
[Fact]
|
|
public async Task SequenceEqual_Null()
|
|
public async Task SequenceEqual_Null()
|
|
{
|
|
{
|