|
@@ -148,6 +148,82 @@ namespace Tests
|
|
|
Assert.Equal(set.Count, c);
|
|
|
}
|
|
|
|
|
|
+ [Fact]
|
|
|
+ public async Task ToAsyncEnumerable9()
|
|
|
+ {
|
|
|
+ var set = new HashSet<int>(new[] { 1, 2, 3, 4 });
|
|
|
+ var xs = set.ToAsyncEnumerable();
|
|
|
+
|
|
|
+ await SequenceIdentity(xs);
|
|
|
+ }
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public async Task ToAsyncEnumerable10()
|
|
|
+ {
|
|
|
+ var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
|
|
|
+ await SequenceIdentity(xs);
|
|
|
+ }
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void ToAsyncEnumerabl11()
|
|
|
+ {
|
|
|
+ var set = new HashSet<int>(new[] { 1, 2, 3, 4 });
|
|
|
+ var xs = set.ToAsyncEnumerable();
|
|
|
+
|
|
|
+ var xc = xs as ICollection<int>;
|
|
|
+
|
|
|
+ Assert.NotNull(xc);
|
|
|
+
|
|
|
+ Assert.False(xc.IsReadOnly);
|
|
|
+
|
|
|
+ xc.Add(5);
|
|
|
+
|
|
|
+
|
|
|
+ Assert.True(xc.Contains(5));
|
|
|
+
|
|
|
+ Assert.True(xc.Remove(5));
|
|
|
+
|
|
|
+ var arr = new int[4];
|
|
|
+ xc.CopyTo(arr, 0);
|
|
|
+ Assert.True(arr.SequenceEqual(xc));
|
|
|
+ xc.Clear();
|
|
|
+ Assert.Equal(0, xc.Count);
|
|
|
+ }
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void ToAsyncEnumerabl12()
|
|
|
+ {
|
|
|
+ var set = new List<int> { 1, 2, 3, 4 };
|
|
|
+ var xs = set.ToAsyncEnumerable();
|
|
|
+
|
|
|
+ var xl = xs as IList<int>;
|
|
|
+
|
|
|
+ Assert.NotNull(xl);
|
|
|
+
|
|
|
+ Assert.False(xl.IsReadOnly);
|
|
|
+
|
|
|
+ xl.Add(5);
|
|
|
+
|
|
|
+
|
|
|
+ Assert.True(xl.Contains(5));
|
|
|
+
|
|
|
+ Assert.True(xl.Remove(5));
|
|
|
+
|
|
|
+ xl.Insert(2, 10);
|
|
|
+
|
|
|
+ Assert.Equal(2, xl.IndexOf(10));
|
|
|
+ xl.RemoveAt(2);
|
|
|
+
|
|
|
+ xl[0] = 7;
|
|
|
+ Assert.Equal(7, xl[0]);
|
|
|
+
|
|
|
+ var arr = new int[4];
|
|
|
+ xl.CopyTo(arr, 0);
|
|
|
+ Assert.True(arr.SequenceEqual(xl));
|
|
|
+ xl.Clear();
|
|
|
+ Assert.Equal(0, xl.Count);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
[Fact]
|
|
|
public void ToAsyncEnumerable_With_Completed_Task()
|