Exemple #1
0
        public void TestConstructor()
        {
            //---------------Set up test pack-------------------
            string propertyName = "";
            const FilterClauseOperator filterClauseOperator = FilterClauseOperator.OpGreaterThan;
            List <string> props = new List <string> {
                "prop1", "prop2", "prop3"
            };
            string name = propertyName;

            //---------------Execute Test ----------------------
            MultiplePropStringTextBoxFilter filter = new MultiplePropStringTextBoxFilter(GetControlFactory(), props, filterClauseOperator);

            props.ForEach(s => name = s + "/" + name);
            propertyName            = name.Remove(name.Length - 1);
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(ITextBox), filter.Control);
            Assert.AreEqual(propertyName, filter.PropertyName);
            Assert.AreEqual(filterClauseOperator, filter.FilterClauseOperator);
            Assert.IsInstanceOf(typeof(DataViewNullFilterClause), filter.GetFilterClause(new DataViewFilterClauseFactory()));
        }
Exemple #2
0
        public void TestFilterClause_2Prop()
        {
            //---------------Set up test pack-------------------
            const FilterClauseOperator filterClauseOperator = FilterClauseOperator.OpGreaterThan;
            List <string> props = new List <string> {
                "prop1", "prop2"
            };
            MultiplePropStringTextBoxFilter filter = new MultiplePropStringTextBoxFilter(GetControlFactory(), props, filterClauseOperator);
            ITextBox textBox = (ITextBox)filter.Control;
            string   text    = TestUtil.GetRandomString();

            textBox.Text = text;

            //---------------Execute Test ----------------------

            IFilterClause filterClause = filter.GetFilterClause(new DataViewFilterClauseFactory());

            //---------------Test Result -----------------------

            Assert.AreEqual(string.Format("({0} > '{2}') or ({1} > '{2}')", props[0], props[1], text), filterClause.GetFilterClauseString());
            //---------------Tear Down -------------------------
        }