public static void WithSorting_By_Asc() { // arrange SearchOptions options = new SearchOptions(1, 10); options.SortField = "MyCustomField"; options.SortMode = SortMode.Asc; FakeFindFluent <SomeClass> findFluent = new FakeFindFluent <SomeClass>(); // act var result = findFluent.WithSorting(options); var resultAsFakeType = (FakeFindFluent <SomeClass>)result; // assert Assert.NotNull(result); Assert.Single(resultAsFakeType.SortValues); Assert.Equal("MyCustomField", resultAsFakeType.SortValues.First().Key); Assert.Equal(SortMode.Asc, resultAsFakeType.SortValues.First().Value); }
public static void WithSorting_With_Empty_Field() { // arrange SearchOptions options = new SearchOptions { PageNumber = 1, PageSize = 10, SortField = "", SortMode = SortMode.Asc }; FakeFindFluent <SomeClass> findFluent = new FakeFindFluent <SomeClass>(); // act var result = findFluent.WithSorting(options); var resultAsFakeType = (FakeFindFluent <SomeClass>)result; // assert Assert.NotNull(result); Assert.Null(resultAsFakeType.SortValues); }
public static void WithSorting_By_Desc() { // arrange SearchOptions options = new SearchOptions { PageNumber = 1, PageSize = 10, SortField = "MyCustomField2", SortMode = SortMode.Desc }; FakeFindFluent <SomeClass> findFluent = new FakeFindFluent <SomeClass>(); // act var result = findFluent.WithSorting(options); var resultAsFakeType = (FakeFindFluent <SomeClass>)result; // assert Assert.NotNull(result); Assert.Single(resultAsFakeType.SortValues); Assert.Equal("MyCustomField2", resultAsFakeType.SortValues.First().Key); Assert.Equal(SortMode.Desc, resultAsFakeType.SortValues.First().Value); }