AsyncCollectionAssertsTests.cs (110)
22 Assert.Throws<ArgumentNullException>("action", () => Assert.All(new object[0].ToAsyncEnumerable(), (Action<object>)null!));
23 Assert.Throws<ArgumentNullException>("action", () => Assert.All(new object[0].ToAsyncEnumerable(), (Action<object, int>)null!));
29 var items = new[] { 1, 1, 1, 1, 1, 1 }.ToAsyncEnumerable();
37 var items = new[] { 1, 1, 42, 2112, 1, 1 }.ToAsyncEnumerable();
74 await Assert.ThrowsAsync<ArgumentNullException>("action", () => Assert.AllAsync(new object[0].ToAsyncEnumerable(), (Func<object, Task>)null!));
75 await Assert.ThrowsAsync<ArgumentNullException>("action", () => Assert.AllAsync(new object[0].ToAsyncEnumerable(), (Func<object, int, Task>)null!));
81 var items = new[] { 1, 1, 1, 1, 1, 1 }.ToAsyncEnumerable();
89 var items = new[] { 1, 1, 42, 2112, 1, 1 }.ToAsyncEnumerable();
111 var items = new[] { 1, 1, 2, 2, 1, 1 }.ToAsyncEnumerable();
125 var list = new List<int>().ToAsyncEnumerable();
135 var list = new List<int>().ToAsyncEnumerable();
157 var list = new List<int> { 42, 2112 }.ToAsyncEnumerable();
168 var list = new List<int> { 42, 2112 }.ToAsyncEnumerable();
196 var list = new List<int>().ToAsyncEnumerable();
206 var list = new List<int>().ToAsyncEnumerable();
228 var list = new List<int> { 42, 2112 }.ToAsyncEnumerable();
247 var list = new List<int> { 42, 2112 }.ToAsyncEnumerable();
289 var list = new List<object?> { 16, null, "Hi there" }.ToAsyncEnumerable();
297 var list = new List<int> { 42 }.ToAsyncEnumerable();
305 var list = new List<int> { 41, 43 }.ToAsyncEnumerable();
321 var list = new List<object?> { null, 16, "Hi there" }.ToAsyncEnumerable();
335 Assert.Throws<ArgumentNullException>("comparer", () => Assert.Contains(14, new int[0].ToAsyncEnumerable(), null!));
341 var list = new List<int> { 42 }.ToAsyncEnumerable();
360 Assert.Throws<ArgumentNullException>("filter", () => Assert.Contains(new int[0].ToAsyncEnumerable(), (Predicate<int>)null!));
366 var list = new[] { "Hello", "world" }.ToAsyncEnumerable();
374 var list = new[] { "Hello", "world" }.ToAsyncEnumerable();
393 Assert.Throws<ArgumentNullException>("comparer", () => Assert.Distinct(new object[0].ToAsyncEnumerable(), null!));
399 var list = new List<object?> { 16, "Hi there", null }.ToAsyncEnumerable();
407 var list = new List<int> { 42, 42 }.ToAsyncEnumerable();
423 var list = new List<string?> { "a", null, "b", null, "c", "d" }.ToAsyncEnumerable();
439 var list = new string[] { "a", "b", "A" }.ToAsyncEnumerable();
448 var list = new string[] { "a", "b", "A" }.ToAsyncEnumerable();
473 var list = new List<object?> { 16, "Hi there" }.ToAsyncEnumerable();
481 var list = new List<int> { 42 }.ToAsyncEnumerable();
498 var list = new List<int>().ToAsyncEnumerable();
506 var list = new List<object?> { null, 16, "Hi there" }.ToAsyncEnumerable();
520 Assert.Throws<ArgumentNullException>("comparer", () => Assert.DoesNotContain(14, new int[0].ToAsyncEnumerable(), null!));
526 var list = new List<int> { 42 }.ToAsyncEnumerable();
545 Assert.Throws<ArgumentNullException>("filter", () => Assert.DoesNotContain(new int[0].ToAsyncEnumerable(), (Predicate<int>)null!));
551 var list = new[] { "Hello", "world" }.ToAsyncEnumerable();
567 var list = new[] { "Hello", "world" }.ToAsyncEnumerable();
584 var list = new List<int>().ToAsyncEnumerable();
592 var list = new List<int> { 42 }.ToAsyncEnumerable();
607 var enumerator = new SpyEnumerator<int>(Enumerable.Empty<int>().ToAsyncEnumerable());
651 validateError(() => Assert.Equal(expected.ToAsyncEnumerable(), actual), "<generated>");
657 var actual = new int[0].ToAsyncEnumerable();
683 var actual = expected.ToAsyncEnumerable();
686 Assert.Equal(expected.ToAsyncEnumerable(), actual);
739 var actual = actualArray is null ? null : new List<int>(actualArray).ToAsyncEnumerable();
774 validateError(() => Assert.Equal(expected?.ToAsyncEnumerable(), actual), expected is null ? "" : "<generated> ");
784 var actual = expected.ToAsyncEnumerable();
806 validateError(() => Assert.Equal(expected.ToAsyncEnumerable(), actual, new IntComparer(false)), "", "");
813 var actual = new int[] { 0, 0, 0, 0, 0 }.ToAsyncEnumerable();
816 Assert.Equal(expected.ToAsyncEnumerable(), actual, new IntComparer(true));
840 Assert.Equal(expected, actual.ToAsyncEnumerable(), new EnumerableItemComparer());
841 Assert.Equal(expected.ToAsyncEnumerable(), actual.ToAsyncEnumerable(), new EnumerableItemComparer());
887 validateError(() => Assert.Equal(new[] { 1, 2 }, new[] { 1, 3 }.ToAsyncEnumerable(), new ThrowingComparer()), "int[] ", "<generated> ");
888 validateError(() => Assert.Equal(new[] { 1, 2 }.ToAsyncEnumerable(), new[] { 1, 3 }.ToAsyncEnumerable(), new ThrowingComparer()), "", "");
907 var actual = new[] { new EquatableObject { Char = 'a' } }.ToAsyncEnumerable();
910 Assert.Equal(expected.ToAsyncEnumerable(), actual);
917 var actual = new[] { new EquatableObject { Char = 'b' } }.ToAsyncEnumerable();
939 validateError(() => Assert.Equal(expected.ToAsyncEnumerable(), actual), "", "");
957 var actual = new List<int>(new int[] { 1, 2, 3, 4, 5 }).ToAsyncEnumerable();
979 validateError(() => Assert.Equal(expected.ToAsyncEnumerable(), actual, (int x, int y) => false), "", "");
986 var actual = new List<int>(new int[] { 0, 0, 0, 0, 0 }).ToAsyncEnumerable();
989 Assert.Equal(expected.ToAsyncEnumerable(), actual, (int x, int y) => true);
997 var actual = new List<EnumerableItem> { new(0), new(2) }.ToAsyncEnumerable();
1000 Assert.Equal(expected.ToAsyncEnumerable(), actual, (x, y) => x.Value / 2 == y.Value / 2);
1018 var actual = new[] { 1, 3 }.ToAsyncEnumerable();
1041 validateError(() => Assert.Equal(expected.ToAsyncEnumerable(), actual, (int e, int a) => throw new DivideByZeroException()), "", "");
1051 var list = new List<int>().ToAsyncEnumerable();
1065 var list = new List<int> { 42 }.ToAsyncEnumerable();
1073 var enumerator = new SpyEnumerator<int>(Enumerable.Range(0, 1).ToAsyncEnumerable());
1114 Assert.NotEqual(expected.ToAsyncEnumerable(), actual);
1120 var actual = new int[0].ToAsyncEnumerable();
1133 var actual = new List<int>(expected).ToAsyncEnumerable();
1153 validateError(() => Assert.NotEqual(expected.ToAsyncEnumerable(), actual), "", "");
1160 var actual = new List<int>(new[] { 1, 2, 3, 4, 0, 6, 7, 8, 9, 10 }).ToAsyncEnumerable();
1163 Assert.NotEqual(expected.ToAsyncEnumerable(), actual);
1173 var actual = new List<int>(new int[] { 1, 2, 3, 4, 5 }).ToAsyncEnumerable();
1176 Assert.NotEqual(expected.ToAsyncEnumerable(), actual, new IntComparer(false));
1183 var actual = new List<int>(new int[] { 0, 0, 0, 0, 0 }).ToAsyncEnumerable();
1203 validateError(() => Assert.NotEqual(expected.ToAsyncEnumerable(), actual, new IntComparer(true)), "", "");
1224 var actual = new[] { 1, 2 }.ToAsyncEnumerable();
1247 validateError(() => Assert.NotEqual(expected.ToAsyncEnumerable(), actual, new ThrowingComparer()), "", "");
1266 var actual = new[] { new EquatableObject { Char = 'a' } }.ToAsyncEnumerable();
1286 validateError(() => Assert.NotEqual(expected.ToAsyncEnumerable(), actual), "", "");
1293 var actual = new[] { new EquatableObject { Char = 'b' } }.ToAsyncEnumerable();
1296 Assert.NotEqual(expected.ToAsyncEnumerable(), actual);
1314 var actual = new List<int>(new int[] { 1, 2, 3, 4, 5 }).ToAsyncEnumerable();
1317 Assert.NotEqual(expected.ToAsyncEnumerable(), actual, (int x, int y) => false);
1324 var actual = new List<int>(new int[] { 0, 0, 0, 0, 0 }).ToAsyncEnumerable();
1344 validateError(() => Assert.NotEqual(expected.ToAsyncEnumerable(), actual, (int x, int y) => true), "", "");
1351 var actual = new[] { 1, 2 }.ToAsyncEnumerable();
1374 validateError(() => Assert.NotEqual(expected.ToAsyncEnumerable(), actual, (int e, int a) => throw new DivideByZeroException()), "", "");
1390 var collection = new object[0].ToAsyncEnumerable();
1401 var collection = new[] { "Hello" }.ToAsyncEnumerable();
1411 var collection = new[] { "Hello", "World" }.ToAsyncEnumerable();
1426 var collection = new[] { 1, 2, 3, 4, 5, 6, 7 }.ToAsyncEnumerable();
1441 var collection = "H".ToAsyncEnumerable();
1451 var collection = "Hello".ToAsyncEnumerable();
1470 Assert.Throws<ArgumentNullException>("predicate", () => Assert.Single(new object[0].ToAsyncEnumerable(), null!));
1476 var collection = new[] { "Hello", "World" }.ToAsyncEnumerable();
1486 var collection = new[] { "Hello", "World" }.ToAsyncEnumerable();
1502 var collection = new[] { "Hello", "World" }.ToAsyncEnumerable();
1519 var collection = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 4 }.ToAsyncEnumerable();
1536 var collection = "H".ToAsyncEnumerable();
1546 var collection = "H".ToAsyncEnumerable();