Permalink
Browse files

Let IOrderedAsyncQueryable<T> implement IOrderedAsyncQueryable

If a class like AsyncEnumerableQuery implements
IOrderedAsyncQueryable<T>, it does not automatically implement
IOrderedAsyncQueryable<T>, which can be a problem within untyped code.
  • Loading branch information...
1 parent e0b6af3 commit d39463c0e7a06eecbe0a88283d980332810d1439 @axelheer axelheer committed Dec 6, 2016
@@ -14,7 +14,7 @@ public interface IOrderedAsyncQueryable : IAsyncQueryable
/// Ordered asynchronous enumerable sequence represented by an expression tree.
/// </summary>
/// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- public interface IOrderedAsyncQueryable<out T> : IAsyncQueryable<T>
+ public interface IOrderedAsyncQueryable<out T> : IAsyncQueryable<T>, IOrderedAsyncQueryable
{
}
}
@@ -0,0 +1,24 @@
+using System.Linq;
+using Xunit;
+
+namespace Tests
+{
+ public class AsyncEnumerableQueryTest
+ {
+ [Fact]
+ public void CastToUntypedIAsyncQueryable()
+ {
+ var query = Enumerable.Empty<string>().ToAsyncEnumerable().AsAsyncQueryable();
+
+ Assert.IsAssignableFrom<IAsyncQueryable>(query);
+ }
+
+ [Fact]
+ public void CastToUntypedIOrderedAsyncQueryable()
+ {
+ var query = Enumerable.Empty<string>().ToAsyncEnumerable().AsAsyncQueryable().OrderBy(s => s.Length);
+
+ Assert.IsAssignableFrom<IOrderedAsyncQueryable>(query);
+ }
+ }
+}

0 comments on commit d39463c

Please sign in to comment.