public CreateCompositeFilterClause ( IFilterClause leftClause, FilterClauseCompositeOperator compositeOperator, IFilterClause rightClause ) : IFilterClause | ||
leftClause | IFilterClause | The left filter clause |
compositeOperator | FilterClauseCompositeOperator | The composite operator, such as /// "and" or "or" |
rightClause | IFilterClause | The right filter clause |
Результат | IFilterClause |
public void MultipleFilters() { //---------------Set up test pack------------------- IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory(); IFilterControl filterControl = GetControlFactory().CreateFilterControl(); ITextBox tb = filterControl.AddStringFilterTextBox("Test:", "TestColumn"); tb.Text = "testvalue"; IFilterClause clause = filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpLike, "testvalue"); ITextBox tb2 = filterControl.AddStringFilterTextBox("Test2:", "TestColumn2"); tb2.Text = "testvalue2"; //---------------Execute Test ---------------------- string filterClause = filterControl.GetFilterClause().GetFilterClauseString(); //---------------Test Result ----------------------- IFilterClause clause2 = filterClauseFactory.CreateStringFilterClause("TestColumn2", FilterClauseOperator.OpLike, "testvalue2"); IFilterClause compositeClause = filterClauseFactory.CreateCompositeFilterClause(clause, FilterClauseCompositeOperator.OpAnd, clause2); Assert.AreEqual(compositeClause.GetFilterClauseString(), filterClause); //---------------Tear Down ------------------------- }
public void TestAddDateFilterDateTimePicker_Composites() { //---------------Set up test pack------------------- IControlFactory factory = GetControlFactory(); IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory(); IFilterControl filterControl = factory.CreateFilterControl(); DateTime testDate1 = DateTime.Now; DateTime testDate2 = testDate1.AddDays(1); filterControl.AddDateFilterDateTimePicker("test1:", "TestColumn1", testDate1, FilterClauseOperator.OpLessThan, false); filterControl.AddDateFilterDateTimePicker("test2:", "TestColumn2", testDate2, FilterClauseOperator.OpLessThan, false); //---------------Execute Test ---------------------- string expectedFilterClause = filterControl.GetFilterClause().GetFilterClauseString(); //---------------Test Result ----------------------- IFilterClause clause1 = filterClauseFactory.CreateDateFilterClause("TestColumn1", FilterClauseOperator.OpLessThan, new DateTime(testDate1.Year, testDate1.Month, testDate1.Day)); IFilterClause clause2 = filterClauseFactory.CreateDateFilterClause("TestColumn2", FilterClauseOperator.OpLessThan, new DateTime(testDate2.Year, testDate2.Month, testDate2.Day)); IFilterClause compClause = filterClauseFactory.CreateCompositeFilterClause(clause1, FilterClauseCompositeOperator.OpAnd, clause2); Assert.AreEqual(compClause.GetFilterClauseString(), expectedFilterClause); //---------------Tear Down ------------------------- }
public void TestAdd_DateRangeFilterComboBoxExclusive() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory(); DateTime testDate = new DateTime(2007, 1, 2, 3, 4, 5, 6); //---------------Execute Test ---------------------- IDateRangeComboBox dr1 = filterControl.AddDateRangeFilterComboBox("test", "test", false, false); dr1.UseFixedNowDate = true; dr1.FixedNowDate = testDate; dr1.SelectedItem = "Today"; IFilterClause clause1 = filterClauseFactory.CreateDateFilterClause("test", FilterClauseOperator.OpGreaterThan, new DateTime(2007, 1, 2, 0, 0, 0)); IFilterClause clause2 = filterClauseFactory.CreateDateFilterClause("test", FilterClauseOperator.OpLessThan, new DateTime(2007, 1, 2, 23, 59, 59, 999)); IFilterClause compClause = filterClauseFactory.CreateCompositeFilterClause(clause1, FilterClauseCompositeOperator.OpAnd, clause2); //---------------Test Result ----------------------- Assert.AreEqual(compClause.GetFilterClauseString(), filterControl.GetFilterClause().GetFilterClauseString()); }
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 ------------------------- }