public void TakeLastElementSuccessfully()
        {
            // Arrange
            const string expectedName = "Expected";
            var filterRules = new OrderByFilterRules()
                            {
                                Skip = 2,
                                Take = 1
                            };
            var entities = new List<UserProfileEntity>
                                                   {
                                                       new UserProfileEntity(),
                                                       new UserProfileEntity(),
                                                       new UserProfileEntity{UserName = expectedName}
                                                   };

            IFilter filter = new EntityFilter(_lambdaCreator);
            
            // Act
            var result = filter.FilterWithOrder(entities, filterRules);

            // Assert
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(expectedName, result[0].UserName);

        }
        public void Return0ElementsIfTakeIsLesserThan1()
        {
            // Arrange
            var invalidFilter = new OrderByFilterRules() {Take = -1};
            var entities = Enumerable.Range(1, 30)
                           .Select(_ => new UserProjectEntity())
                           .ToList();
            IFilter entityFilter = new EntityFilter(_lambdaCreator);

            // Act
            var res = entityFilter.FilterWithOrder(entities, invalidFilter);

            Assert.AreEqual(0, res.Count);

        }
        public void OrderByDescendingSuccessfully()
        {
            // Arrange
            const int max = 30;
            var filterRules = new OrderByFilterRules() {Take = 5, Orderby = "Created"};
            var entities = Enumerable.Range(1, max)
                           .Select(value => new UserProjectEntity
                                                {
                                                    Created = DateTime.MinValue + TimeSpan.FromDays(value),
                                                    Name = value.ToString(CultureInfo.InvariantCulture)
                                                })
                           .ToList();
            IFilter filter = new EntityFilter(_lambdaCreator);

            // Act
            var result = filter.FilterWithOrder(entities, filterRules);
            string firstElementName = result.First().Name;


            // Assert
            Assert.AreEqual(max.ToString(), firstElementName);

        }
        public void ReturnResultEvenIfRangeIsBiggerThanLength()
        {
            // Arrange
            const int max = 15;
            const int skip = 10;
            var filterRules = new OrderByFilterRules() { Take = 10, Orderby = "Created", Skip = skip};
            var entities = Enumerable.Range(1, max)
                           .Select(value => new UserProjectEntity
                           {
                               Created = DateTime.MinValue + TimeSpan.FromDays(value),
                               Name = value.ToString(CultureInfo.InvariantCulture)
                           })
                           .ToList();
            IFilter filter = new EntityFilter(_lambdaCreator);


            // Act
            var result = filter.FilterWithOrder(entities, filterRules);

            // Assert
            Assert.AreEqual(5, result.Count);
        }