public void Generic_ForEachAsync_throws_OperationCanceledException_if_task_is_cancelled() { var query = new DbRawSqlQuery <FakeEntity>(MockHelper.CreateInternalSqlNonSetQuery("select * from products")); Assert.Throws <OperationCanceledException>( () => query.ForEachAsync(e => { }, new CancellationToken(canceled: true)) .GetAwaiter().GetResult()); }
public void Non_generic_ForEachAsync_throws_OperationCanceledException_if_task_is_cancelled() { var query = new DbRawSqlQuery(MockHelper.CreateInternalSqlSetQuery("query", false, 1, 2)); Assert.Throws <OperationCanceledException>( () => query.ForEachAsync(o => { }, new CancellationToken(canceled: true)) .GetAwaiter().GetResult()); }