public void Match_Boolean_everything_else(OperatorTypeEnum operatorType) { var sut = new Criterion { Operator = new Operator { DataType = DataTypeEnum.Boolean, OperatorType = operatorType }, PropertyValue = true.ToString() }; var actual = sut.Match(true); Assert.False(actual); }
public void Match_String_operators(OperatorTypeEnum operatorType, string left, string right, bool expected) { var sut = new Criterion { Operator = new Operator { DataType = DataTypeEnum.String, OperatorType = operatorType }, PropertyValue = right }; var actual = sut.Match(left); Assert.Equal(expected, actual); }
public void Match_Long_operators(OperatorTypeEnum operatorType, long left, long right, bool expected) { var sut = new Criterion { Operator = new Operator { DataType = DataTypeEnum.Long, OperatorType = operatorType }, PropertyValue = right.ToString(CultureInfo.InvariantCulture) }; var actual = sut.Match(left); Assert.Equal(expected, actual); }
public void Match_DateTime_everything_else(OperatorTypeEnum operatorType) { var value = DateTime.UtcNow; var sut = new Criterion { Operator = new Operator { DataType = DataTypeEnum.DateTime, OperatorType = operatorType }, PropertyValue = value.ToString(CultureInfo.InvariantCulture) }; var actual = sut.Match(value); Assert.False(actual); }
public void Match_DateTime_operators(OperatorTypeEnum operatorType, int year, int month, int day, int d, bool expected) { var value = new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc); var sut = new Criterion { Operator = new Operator { DataType = DataTypeEnum.DateTime, OperatorType = operatorType }, PropertyValue = value.AddDays(d).ToString(CultureInfo.InvariantCulture) }; var actual = sut.Match(value); Assert.Equal(expected, actual); }
public void Match_Boolean_equals(bool lhs, bool rhs) { var expected = lhs == rhs; var sut = new Criterion { Operator = new Operator { DataType = DataTypeEnum.Boolean, OperatorType = OperatorTypeEnum.Equals }, PropertyValue = rhs.ToString(), }; var actual = sut.Match(lhs); Assert.Equal(expected, actual); }
public void Match_with_inverted_operator() { var value = "blaroiew"; var sut = new Criterion { Operator = new Operator { DataType = DataTypeEnum.String, IsInverted = true, OperatorType = OperatorTypeEnum.Equals }, PropertyValue = value.ToString(CultureInfo.InvariantCulture) }; var actual = sut.Match(value); Assert.False(actual); }