AsAsyncEnumerable.cs 875 B

123456789101112131415161718192021222324252627282930313233
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Xunit;
  8. namespace Tests
  9. {
  10. public class AsAsyncEnumerable : AsyncEnumerableTests
  11. {
  12. [Fact]
  13. public void AsAsyncEnumerable_Null()
  14. {
  15. AssertThrows<ArgumentNullException>(() => AsyncEnumerable.AsAsyncEnumerable(default(IAsyncEnumerable<int>)));
  16. }
  17. [Fact]
  18. public void AsAsyncEnumerable1()
  19. {
  20. var xs = Return42;
  21. var ys = xs.AsAsyncEnumerable();
  22. Assert.NotSame(xs, ys);
  23. var e = xs.GetAsyncEnumerator();
  24. HasNext(e, 42);
  25. NoNext(e);
  26. }
  27. }
  28. }