public void TestTwoStringTextBoxFilter()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory itsFilterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl          = GetControlFactory().CreateFilterControl();
            ITextBox             tb = filterControl.AddStringFilterTextBox("Test:", "TestColumn");

            tb.Text = "testvalue";
            ITextBox tb2 = filterControl.AddStringFilterTextBox("Test:", "TestColumn2");

            tb2.Text = "testvalue2";

            //---------------Execute Test ----------------------
            string filterClauseString = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause1 =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpLike, "testvalue");
            IFilterClause clause2 =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn2", FilterClauseOperator.OpLike, "testvalue2");
            IFilterClause fullClause =
                itsFilterClauseFactory.CreateCompositeFilterClause(clause1, FilterClauseCompositeOperator.OpAnd, clause2);

            Assert.AreEqual(fullClause.GetFilterClauseString(), filterClauseString);

            //---------------Tear Down -------------------------
        }
 public void TestEquals()
 {
     dv.RowFilter =
         filterClauseFactory.CreateStringFilterClause("h a", FilterClauseOperator.OpEquals, "Peter").
         GetFilterClauseString();
     Assert.AreEqual(1, dv.Count);
 }
        public void TestTwoCheckBoxFilter()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory itsFilterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl          = GetControlFactory().CreateFilterControl();

            filterControl.AddBooleanFilterCheckBox("Test1?", "TestColumn1", true);
            filterControl.AddBooleanFilterCheckBox("Test2?", "TestColumn2", false);

            //---------------Execute Test ----------------------
            string filterClauseString = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause1 =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn1", FilterClauseOperator.OpEquals, "true");
            IFilterClause clause2 =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn2", FilterClauseOperator.OpEquals, "false");
            IFilterClause fullClause =
                itsFilterClauseFactory.CreateCompositeFilterClause(clause1, FilterClauseCompositeOperator.OpAnd, clause2);

            Assert.AreEqual(fullClause.GetFilterClauseString(), filterClauseString);

            //---------------Tear Down -------------------------
        }
        public void TestAddStringFilterCheckBox()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl       = GetControlFactory().CreateFilterControl();

            //---------------Execute Test ----------------------
            filterControl.AddBooleanFilterCheckBox("Test?", "TestColumn", true);
            //---------------Test Result -----------------------
            IFilterClause clause =
                filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpEquals, "true");

            Assert.AreEqual(clause.GetFilterClauseString(), filterControl.GetFilterClause().GetFilterClauseString());

            //---------------Tear Down -------------------------
        }
Exemple #5
0
        public virtual void TestWinApplyFilterFiresFilterUpdatedEvent()
        {
            //---------------Set up test pack-------------------
            BusinessObjectCollection <MyBO> col;
            GridBaseWin          gridBase     = (GridBaseWin)GetGridBaseWith_4_Rows(out col).GetControl();
            string               filterString = col[2].ID.ToString().Substring(5, 30);
            IFilterClauseFactory factory      = new DataViewFilterClauseFactory();
            IFilterClause        filterClause =
                factory.CreateStringFilterClause(_gridIdColumnName, FilterClauseOperator.OpLike, filterString);
            bool filterUpdatedFired = false;

            gridBase.FilterUpdated += delegate { filterUpdatedFired = true; };
            //---------------Execute Test ----------------------
            gridBase.ApplyFilter(filterClause);
            //---------------Test Result -----------------------
            Assert.IsTrue(filterUpdatedFired);
        }
        public void ClearFilters_FIXBUG()
        {
            //---------------Set up test pack-------------------
            GridLayoutManager layoutManager = new GridLayoutManager(GetControlFactory().CreatePanel(),
                                                                    GetControlFactory());
            IFilterClauseFactory filterClauseFactory  = new DataViewFilterClauseFactory();
            FilterControlManager filterControlManager = new FilterControlManager(GetControlFactory(), layoutManager);

            filterControlManager.AddStringFilterTextBox("Test:", "TestColumn");
            filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpLike, "testvalue");

            filterControlManager.AddStringFilterTextBox("Test2:", "TestColumn2");
            filterControlManager.GetFilterClause().GetFilterClauseString();
            //---------------Execute Test ----------------------
            filterControlManager.ClearFilters();
            //---------------Test Result -----------------------
            Assert.IsTrue(true, "Should not cause an Erro");
        }
        public void TestGetComboBoxFilterClause()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl       = GetControlFactory().CreateFilterControl();
            IComboBox            comboBox            = TestFilterControlManager.GetFilterComboBox_2Items(filterControl);

            //---------------Execute Test ----------------------
            comboBox.SelectedIndex = 1;
            string filterClauseString = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause =
                filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpEquals, "1");

            Assert.AreEqual(clause.GetFilterClauseString(), filterClauseString);

            //---------------Tear Down -------------------------
        }
        public void TestGetTextBoxFilterClause_Equals()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory itsFilterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl          = GetControlFactory().CreateFilterControl();
            ITextBox             tb = filterControl.AddStringFilterTextBox("Test:", "TestColumn", FilterClauseOperator.OpEquals);

            //---------------Execute Test ----------------------
            tb.Text = "testvalue";
            string filterClauseString = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpEquals, "testvalue");

            Assert.AreEqual(clause.GetFilterClauseString(), filterClauseString);

            //---------------Tear Down -------------------------
        }
Exemple #9
0
        public override void TestWinApplyFilterFiresFilterUpdatedEvent()
        {
            //---------------Set up test pack-------------------
            BusinessObjectCollection <MyBO> col;
            var gridBase = GetGridBaseWith_4_Rows(out col) as WinFormsGridBaseAdapter;

            Assert.IsNotNull(gridBase);
            string filterString               = col[2].TestProp.ToString().Substring(1, 10);
            IFilterClauseFactory factory      = new DataViewFilterClauseFactory();
            IFilterClause        filterClause =
                factory.CreateStringFilterClause("TestProp", FilterClauseOperator.OpLike, filterString);
            bool filterUpdatedFired = false;

            gridBase.FilterUpdated += delegate { filterUpdatedFired = true; };
            //---------------Execute Test ----------------------
            gridBase.ApplyFilter(filterClause);
            //---------------Test Result -----------------------
            Assert.IsTrue(filterUpdatedFired);
        }
        public void TestGetMulitplePropTextBoxFilterClause()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory itsFilterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl          = GetControlFactory().CreateFilterControl();
            ITextBox             tb = filterControl.AddMultiplePropStringTextBox("Test:", new List <string> {
                "TestColumn"
            });

            //---------------Execute Test ----------------------
            tb.Text = "testvalue";
            string filterClauseString = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpLike, "testvalue");

            Assert.AreEqual(clause.GetFilterClauseString(), filterClauseString);

            //---------------Tear Down -------------------------
        }
Exemple #11
0
        public void TestClearFilter1()
        {
            //---------------Set up test pack-------------------
            BusinessObjectCollection <MyBO> col;
            IGridBase            gridBase     = GetGridBaseWith_4_Rows(out col);
            string               filterString = col[2].TestProp.ToString().Substring(0, 10);
            IFilterClauseFactory factory      = new DataViewFilterClauseFactory();
            IFilterClause        filterClause =
                factory.CreateStringFilterClause("TestProp", FilterClauseOperator.OpLike, filterString);

            gridBase.ApplyFilter(filterClause);

            //---------------Verify PreConditions --------------
            Assert.AreEqual(1, gridBase.Rows.Count, "Filtered Grid should have 1 item");

            //---------------Execute Test ----------------------
            gridBase.ApplyFilter(null);

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

            Assert.AreEqual(4, gridBase.Rows.Count);
            //---------------Tear Down -------------------------
        }
        public void Test_ClearFilters()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl       = GetControlFactory().CreateFilterControl();
            ITextBox             tb = filterControl.AddStringFilterTextBox("Test:", "TestColumn");

            tb.Text = "testvalue";
            filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpLike, "testvalue");

            ITextBox tb2 = filterControl.AddStringFilterTextBox("Test2:", "TestColumn2");

            tb2.Text = "testvalue2";
            string initialFilterClause = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Assert Precondition----------------
            Assert.IsFalse(string.IsNullOrEmpty(initialFilterClause), "Should not be empty : " + initialFilterClause);
            //---------------Execute Test ----------------------
            filterControl.ClearFilters();
            //---------------Test Result -----------------------
            string finalFilterClause = filterControl.GetFilterClause().GetFilterClauseString();

            Assert.IsTrue(string.IsNullOrEmpty(finalFilterClause), "Should be empty : " + finalFilterClause);
        }