Exemple #1
0
        public void SortByPredicate_Ascending_SortedList()
        {
            var list  = SimpleObject.GetMockDataSetAsQueryable();
            var items = list.SortBy(x => x.Title).ToArray();

            Assert.Equal(1, items[0].Id);
            Assert.Equal("Title 1", items[0].Title);
        }
Exemple #2
0
        public void SortBy_DescendingWithSkip_SortedList()
        {
            var list  = SimpleObject.GetMockDataSetAsQueryable();
            var items = list.SortBy("Title", false).Skip(2).ToArray();

            Assert.Equal(3, items[0].Id);
            Assert.Equal("Title 3", items[0].Title);
        }
Exemple #3
0
        public void SortBy_NoKeySelector_Source()
        {
            Func <SimpleObject, dynamic> key = null;
            var list  = SimpleObject.GetMockDataSetAsQueryable();
            var items = list.SortBy(key);

            Assert.Equal(list, items);
        }
Exemple #4
0
        public void SortBy_NoPropertyName_UnsortedList()
        {
            var list  = SimpleObject.GetMockDataSetAsQueryable();
            var items = list.SortBy(null).ToArray();

            Assert.Equal(1, items[0].Id);
            Assert.Equal("Title 1", items[0].Title);
        }
Exemple #5
0
        public void WhereIf_SingleTrueCondition_FilteredList()
        {
            var list  = SimpleObject.GetMockDataSetAsQueryable();
            var items = list.WhereIf(true, x => x.Id == 3).ToArray();

            Assert.Equal(3, items[0].Id);
            Assert.Equal("Title 3", items[0].Title);
        }