public void InitTest_CUST_AndPreviouslyApplied() { NumericFilterVM target = new NumericFilterVM(); string columnName = "TestColumn1"; string columnTitle = "Test Column 1"; NumericFilterSelectionType _filterType = new NumericFilterSelectionType(); _filterType = NumericFilterSelectionType.CUSTOM; FilterColumn _column = new FilterColumn(); _column.ColumnName = columnName; _column.FilterType = FilterSelectionType.NUMERIC_CUST; _column.ColumnSelectedDataList = new System.Collections.Generic.List<string>(); _column.ConditionList = new System.Collections.Generic.List<Condition>(); Condition cond = new Condition(); cond.IncludedConditionList = new System.Collections.ObjectModel.ObservableCollection<Condition>(); cond.LogicalOperatorOfIncludedCondition = LogicOperatorType.AND; Condition cond1 = new Condition("TestColumn1", OperatorType.GREATER_THAN_OR_EQUAL); Condition cond2 = new Condition("TestColumn1", OperatorType.LESS_THAN_OR_EQUAL); cond.IncludedConditionList.Add(cond1); cond.IncludedConditionList.Add(cond2); _column.ConditionList.Add(cond); _column.CurrentRowDataValue = null; target.Init(columnName, columnTitle, _filterType, _column); Assert.AreEqual(columnName, target.FieldName); Assert.AreEqual(columnTitle, target.FieldNameTitle); Assert.AreEqual(OperatorType.GREATER_THAN_OR_EQUAL, target.FirstCondition.ConditionOperator); Assert.AreEqual(cond1, target.FirstCondition); Assert.AreEqual(cond2, target.SecondCondition); }
public void InitTest_EQ() { NumericFilterVM target = new NumericFilterVM(); string columnName = "TestColumn1"; string columnTitle = "Test Column 1"; NumericFilterSelectionType _filterType = new NumericFilterSelectionType(); _filterType = NumericFilterSelectionType.EQUAL; FilterColumn _column = new FilterColumn(); _column.ColumnName = columnName; _column.ColumnSelectedDataList = new System.Collections.Generic.List<string>(); _column.ConditionList = new System.Collections.Generic.List<Condition>(); _column.CurrentRowDataValue = null; target.Init(columnName, columnTitle, _filterType, _column); Assert.AreEqual(columnName, target.FieldName); Assert.AreEqual(columnTitle, target.FieldNameTitle); Assert.AreEqual(OperatorType.EQUAL, target.FirstCondition.ConditionOperator); }
public void InitTest_NE_AndPreviouslyApplied() { NumericFilterVM target = new NumericFilterVM(); string columnName = "TestColumn1"; string columnTitle = "Test Column 1"; NumericFilterSelectionType _filterType = new NumericFilterSelectionType(); _filterType = NumericFilterSelectionType.NOT_EQUAL; FilterColumn _column = new FilterColumn(); _column.ColumnName = columnName; _column.FilterType = FilterSelectionType.NUMERIC_NE; _column.ColumnSelectedDataList = new System.Collections.Generic.List<string>(); _column.ConditionList = new System.Collections.Generic.List<Condition>(); Condition cond = new Condition("TestColumn1", OperatorType.NOT_EQUAL); _column.ConditionList.Add(cond); _column.CurrentRowDataValue = null; target.Init(columnName, columnTitle, _filterType, _column); Assert.AreEqual(columnName, target.FieldName); Assert.AreEqual(columnTitle, target.FieldNameTitle); Assert.AreEqual(OperatorType.NOT_EQUAL, target.FirstCondition.ConditionOperator); Assert.AreEqual(cond, target.FirstCondition); }