public void Test_ClearEnumComboBoxFilter_ShouldClearTextInCombo() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); IComboBox comboBox = filterControl.AddEnumFilterComboBox("Test", "Test", typeof(PurchaseOrderStatus)); comboBox.SelectedItem = PurchaseOrderStatus.Processed; //---------------Assert preconditions--------------- Assert.AreEqual("Processed", comboBox.Text); //---------------Execute Test ---------------------- filterControl.ClearFilters(); //---------------Test Result ----------------------- Assert.AreEqual(0, comboBox.SelectedIndex); Assert.AreEqual("", comboBox.Text); }
public void Test_ClearStringComboBoxFilter_ShouldClearTextInCombo() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); IComboBox comboBox = filterControl.AddStringFilterComboBox("Test", "Test", new string[] { "One", "Two", "Three" }, true); comboBox.SelectedItem = "Two"; //---------------Assert preconditions--------------- Assert.AreEqual("Two", comboBox.Text); //---------------Execute Test ---------------------- filterControl.ClearFilters(); //---------------Test Result ----------------------- Assert.AreEqual(-1, comboBox.SelectedIndex); Assert.AreEqual("", comboBox.Text); }
public void Test_ClearDateRangeComboBoxFilter_ShouldClearTextInCombo() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); IComboBox comboBox = filterControl.AddDateRangeFilterComboBox("Test", "Test"); comboBox.SelectedItem = "Today"; //---------------Assert preconditions--------------- Assert.AreEqual("Today", comboBox.Text); //---------------Execute Test ---------------------- filterControl.ClearFilters(); //---------------Test Result ----------------------- Assert.AreEqual(0, comboBox.SelectedIndex); Assert.AreEqual("(Date Ranges)", comboBox.Text); }
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); }