public void TestAdd_AddBooleanFilterCheckBox_CheckBox()
        {
            //---------------Set up test pack-------------------
            IFilterControl filterControl = GetControlFactory().CreateFilterControl();

            //---------------Execute Test ----------------------
            ICheckBox cb = filterControl.AddBooleanFilterCheckBox("Test:", "TestColumn", false);

            //---------------Test Result -----------------------
            Assert.AreEqual(2, filterControl.FilterPanel.Controls.Count);
            Assert.AreSame(cb, filterControl.FilterPanel.Controls[0]);
        }
        public void TestAdd_AddBooleanFilterCheckBox_CheckBox__GetControl()
        {
            //---------------Set up test pack-------------------
            IFilterControl filterControl = GetControlFactory().CreateFilterControl();
            ICheckBox      tbExpected    = filterControl.AddBooleanFilterCheckBox("Test:", "TestColumn", false);

            filterControl.AddStringFilterTextBox("Test2:", "TestColumn2");
            //---------------Execute Test ----------------------
            ICheckBox tbReturned = (ICheckBox)filterControl.GetChildControl("TestColumn");

            //---------------Test Result -----------------------
            Assert.AreSame(tbExpected, tbReturned);
        }
        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 -------------------------
        }
        public void TestChangeCheckBoxAppliesFilter()
        {
            //---------------Set up test pack-------------------
            IControlFactory factory  = GetControlFactory();
            IFilterControl  ctl      = factory.CreateFilterControl();
            ICheckBox       checkBox = ctl.AddBooleanFilterCheckBox("test", "propname", false);

            bool filterFired = false;

            ctl.Filter += delegate { filterFired = true; };
            //---------------Assert Preconditions --------------
            Assert.IsFalse(filterFired);
            //---------------Execute Test ----------------------
            checkBox.Checked = true;
            //---------------Test Result -----------------------
            Assert.IsTrue(filterFired, "The filter event should have been fired when the text was changed.");
        }
        public void TestAddCheckBox()
        {
            //---------------Set up test pack-------------------
            //IFilterClause nullClause = new DataViewNullFilterClause();
            IFilterControl filterControl = GetControlFactory().CreateFilterControl();
            //---------------Execute Test ----------------------
            const string     labelName = "aa";
            IControlHabanero cb        = filterControl.AddBooleanFilterCheckBox(labelName, "", true);

            //---------------Test Result -----------------------
            Assert.IsNotNull(cb);
            Assert.IsTrue(cb is ICheckBox);
            // ICheckBox cBox = (ICheckBox) cb;
            // Assert.AreEqual(labelName, cBox.Text);

            //---------------Tear Down -------------------------
        }
        public void TestChangeCheckBoxDoesNotApplyFilter_InSearchMode()
        {
            //---------------Set up test pack-------------------
            IControlFactory factory = GetControlFactory();
            IFilterControl  ctl     = factory.CreateFilterControl();

            ctl.FilterMode = FilterModes.Search;
            ICheckBox checkBox = ctl.AddBooleanFilterCheckBox("test", "propname", false);

            bool filterFired = false;

            ctl.Filter += delegate { filterFired = true; };
            //---------------Assert Preconditions --------------
            Assert.AreEqual(FilterModes.Search, ctl.FilterMode);
            Assert.IsFalse(filterFired);
            //---------------Execute Test ----------------------
            checkBox.Checked = true;
            //---------------Test Result -----------------------
            Assert.IsFalse(filterFired, "The filter event should not have been fired when the text was changed.");
        }