public void Sort_Inheritance_ShouldSortByStringAsc() { // arrange var value = new ObjectValueNode( new ObjectFieldNode("bar", new EnumValueNode(SortOperationKind.Desc))); SortInputType <FooInherited> sortType = CreateType(new SortInputType <FooInherited>()); IQueryable <FooInherited> a = new[] { new FooInherited { Bar = "b" }, new FooInherited { Bar = "a" }, new FooInherited { Bar = "c" } }.AsQueryable(); // act var context = new QueryableSortVisitorContext(sortType, typeof(FooInherited), false); QueryableSortVisitor.Default.Visit(value, context); ICollection <FooInherited> aFiltered = context.Sort(a).ToList(); // assert Assert.Collection(aFiltered, foo => Assert.Equal("c", foo.Bar), foo => Assert.Equal("b", foo.Bar), foo => Assert.Equal("a", foo.Bar) ); }
public ISortObjectOperationDescriptor <TObject> Type( Action <ISortInputTypeDescriptor <TObject> > descriptor) { var type = new SortInputType <TObject>(descriptor); base.Type(type); return(this); }