Ejemplo n.º 1
0
        public void ToString_TwoPartCompoundExpression_CreatesValidString()
        {
            var filter = new FilterDescriptor(
                LogicalOperators.Or,
                new MobileObservableCollection<IFilterDescriptor>
                    {
                        new FilterDescriptor("FirstName", FilterOperator.StartsWith, "a"),
                        new FilterDescriptor("LastName", FilterOperator.Contains, "ba"),
                    });

            Assert.AreEqual("(FirstName StartsWith {a}) OR (LastName Contains {ba})", filter.ToString());
        }
Ejemplo n.º 2
0
        public void ToString_NestedCompoundExpression_CreatesValidString()
        {
            var filter = new FilterDescriptor(
                LogicalOperators.Or,
                new MobileObservableCollection<IFilterDescriptor>
                    {
                        new FilterDescriptor("FirstName", FilterOperator.StartsWith, "a"),
                        new FilterDescriptor(
                            LogicalOperators.And,
                            new MobileObservableCollection<IFilterDescriptor>
                                {
                                    new FilterDescriptor("LastName", FilterOperator.Contains, "ba"),
                                    new FilterDescriptor("Salary", FilterOperator.IsLessThan, "2000"),
                                })
                    });

            Assert.AreEqual("(FirstName StartsWith {a}) OR ((LastName Contains {ba}) AND (Salary IsLessThan {2000}))", filter.ToString());
        }
Ejemplo n.º 3
0
 public void ToString_SimpleExpression_CreatesValidString()
 {
     var filter = new FilterDescriptor("FirstName", FilterOperator.StartsWith, "a");
     Assert.AreEqual("FirstName StartsWith {a}", filter.ToString());
 }
Ejemplo n.º 4
0
 public void EmptyStringValue_ShouldByEncodedAsBrackets()
 {
     var filter = new FilterDescriptor("FirstName", FilterOperator.StartsWith, string.Empty);
     Assert.AreEqual("FirstName StartsWith {}", filter.ToString());
 }