Ejemplo n.º 1
0
        public void EndsWithFilter(bool isEqual)
        {
            var filter = new EndsWithFilter("Name", "ShareFile", isEqual);

            filter.ToString().Should().Be("endswith(Name, 'ShareFile') eq " + isEqual.ToLowerString());
        }
        public void EnsureImplicitAndFilter()
        {
            // Arrange
            var client = this.GetShareFileClient(true);
            var query = client.Items.GetChildren(client.Items.GetAlias("fileId"));
            
            // Act
            var endsWithFilter = new EndsWithFilter("Property", "value");
            var startsWithFilter = new StartsWithFilter("Property", "value");
            query = query.Filter(endsWithFilter).Filter(startsWithFilter);

            var odataQuery = query as Query<ODataFeed<Item>>;
            var filter = odataQuery.GetFilter();

            // Assert
            filter.Should().BeOfType<AndFilter>();
            (filter as AndFilter).Left.Should().Be(endsWithFilter);
            (filter as AndFilter).Right.Should().Be(startsWithFilter);
        }
Ejemplo n.º 3
0
            private IFilter CreateFilter(OperatorType operators, string propertyName, string propertyValue)
            {
                IFilter filter = null;
                switch (operators)
                {
                    case OperatorType.eq:
                        filter = new EqualToFilter(propertyName, propertyValue);
                        break;
                    case OperatorType.ne:
                        filter = new NotEqualToFilter(propertyName, propertyValue);
                        break;
                    case OperatorType.startswith:
                        filter = new StartsWithFilter(propertyName, propertyValue);
                        break;
                    case OperatorType.endswith:
                        filter = new EndsWithFilter(propertyName, propertyValue);
                        break;
                    case OperatorType.substringof:
                        filter = new SubstringFilter(propertyName, propertyValue);
                        break;
                    /* currently not supported
                    case OperatorType.lt:
                        filter = new LessThanFilter(propertyName, propertyValue);
                        break;
                    case OperatorType.le:
                        filter = new LessThanOrEqualFilter(propertyName, propertyValue);
                        break;
                    case OperatorType.gt:
                        filter = new GreaterThanFilter(propertyName, propertyValue);
                        break;
                    case OperatorType.ge:
                        filter = new GreaterThanOrEqualFilter(propertyName, propertyValue);
                        break;
                     */
                }

                return filter;
            }