// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. #if !NO_TPL using System; using System.Collections.Generic; using System.Linq; using Xunit; namespace Tests { public partial class AsyncTests { public void AssertThrows(Action a) where E : Exception { Assert.Throws(a); } public void AssertThrows(Action a, Func assert) where E : Exception { var hasFailed = false; try { a(); } catch (E e) { Assert.True(assert(e)); hasFailed = true; } if (!hasFailed) { Assert.True(false); } } public void NoNext(IAsyncEnumerator e) { Assert.False(e.MoveNext().Result); } public void HasNext(IAsyncEnumerator e, T value) { Assert.True(e.MoveNext().Result); Assert.Equal(value, e.Current); } } } #endif