A Filter controller for an enum type this allows you set set a comboBox filter for any enum data type.
Inheritance: ICustomFilter
Exemplo n.º 1
0
        /// <summary>
        /// See <see cref="IFilterControl.AddStringFilterComboBox"/>
        /// </summary>
        public ICustomFilter AddEnumFilterComboBox(string labelText, string columnName, Type enumType)
        {
            EnumComboBoxFilter filter = new EnumComboBoxFilter(_controlFactory, columnName, FilterClauseOperator.OpEquals, enumType);

            AddCustomFilter(labelText, filter);
            return(filter);
        }
		public void TestConstructor_ShouldHaveDefaultConstructor()
		{
			//---------------Set up test pack-------------------
			_testBuilder.Initialise();

			//---------------Execute Test ----------------------
			EnumComboBoxFilter filter = new EnumComboBoxFilter(_testBuilder.ControlFactory, _testBuilder.PropertyName, _testBuilder.GetFilterClauseOperator());

			//---------------Test Result -----------------------
			Assert.IsInstanceOf(typeof(IComboBox), filter.Control);
			Assert.AreEqual(_testBuilder.PropertyName, filter.PropertyName);
			Assert.AreEqual(_testBuilder.GetFilterClauseOperator(), filter.FilterClauseOperator);
			Assert.IsInstanceOf(typeof(DataViewNullFilterClause), filter.GetFilterClause(new DataViewFilterClauseFactory()));
		}
		public void TestConstructor_WhenDefaultConstructor_ShouldNotSetupComboBoxItems()
		{
			//---------------Set up test pack-------------------
			_testBuilder.Initialise();
			//---------------Execute Test ----------------------
			var filter = new EnumComboBoxFilter(GetControlFactory(), _testBuilder.PropertyName, _testBuilder.GetFilterClauseOperator());
			//---------------Test Result -----------------------
			Assert.IsInstanceOf(typeof(IComboBox), filter.Control);
			IComboBox comboBox = (IComboBox)filter.Control;
			Assert.AreEqual(0, comboBox.Items.Count, "Should have no Items in combo");
		}
        public void TestConstructor_ShouldSetUpComboBoxItems()
        {
            //---------------Set up test pack-------------------
        	//---------------Execute Test ----------------------
            var filter = new EnumComboBoxFilter(GetControlFactory(), _testBuilder.PropertyName, _testBuilder.GetFilterClauseOperator(), typeof(PurchaseOrderStatus));
			//---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(IComboBox), filter.Control);
            IComboBox comboBox = (IComboBox) filter.Control;
            Assert.AreEqual(3, comboBox.Items.Count, "Two Items and Blank");
       }
 /// <summary>
 /// See <see cref="IFilterControl.AddStringFilterComboBox"/>
 /// </summary>
 public ICustomFilter AddEnumFilterComboBox(string labelText, string columnName, Type enumType)
 {
     EnumComboBoxFilter filter = new EnumComboBoxFilter(_controlFactory, columnName, FilterClauseOperator.OpEquals, enumType);
     AddCustomFilter(labelText, filter);
     return filter;
 }