// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Linq; using Xunit; namespace Tests { public partial class AsyncTests { [Fact] public void MoveNextExtension_Null() { var en = default(IAsyncEnumerator); Assert.ThrowsAsync(() => en.MoveNextAsync()); } [Fact] public void SelectWhere2() { var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); var ys = xs.Select(i => i + 2).Where(i => i % 2 == 0); var e = ys.GetAsyncEnumerator(); HasNext(e, 2); HasNext(e, 4); NoNext(e); } [Fact] public void WhereSelect2() { var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); var ys = xs.Where(i => i % 2 == 0).Select(i => i + 2); var e = ys.GetAsyncEnumerator(); HasNext(e, 2); HasNext(e, 4); NoNext(e); } [Fact] public void WhereSelect3() { var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); var ys = xs.Where(i => i % 2 == 0).Select(i => i + 2).Select(i => i + 2); var e = ys.GetAsyncEnumerator(); HasNext(e, 4); HasNext(e, 6); NoNext(e); } } }