本文整理汇总了C#中Criteria.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Criteria.Equals方法的具体用法?C# Criteria.Equals怎么用?C# Criteria.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEquals_WrongType
public void TestEquals_WrongType()
{
//---------------Set up test pack-------------------
DateTime dateTimeValue = DateTime.Now;
const string datetimePropName = "DateTime";
Criteria criteria1 = new Criteria(datetimePropName, Criteria.ComparisonOp.GreaterThan, dateTimeValue);
//---------------Execute Test ----------------------
bool areEquals = criteria1.Equals(6);
//---------------Test Result -----------------------
Assert.IsFalse(areEquals);
//---------------Tear Down -------------------------
}
示例2: TestEquals_Composite_True
public void TestEquals_Composite_True()
{
//---------------Set up test pack-------------------
DateTime dateTimeValue1 = DateTime.Now;
DateTime dateTimeValue2 = DateTime.Now.AddDays(20);
const string datetimePropName = "DateTime";
Criteria criteria1 = new Criteria(datetimePropName, Criteria.ComparisonOp.GreaterThan, dateTimeValue1);
Criteria criteria2 = new Criteria(datetimePropName, Criteria.ComparisonOp.GreaterThan, dateTimeValue2);
Criteria composite1 = new Criteria(criteria1, Criteria.LogicalOp.And, criteria2);
Criteria criteria3 = new Criteria(datetimePropName, Criteria.ComparisonOp.GreaterThan, dateTimeValue1);
Criteria criteria4 = new Criteria(datetimePropName, Criteria.ComparisonOp.GreaterThan, dateTimeValue2);
Criteria composite2 = new Criteria(criteria3, Criteria.LogicalOp.And, criteria4);
//---------------Execute Test ----------------------
bool areEquals = composite1.Equals(composite2);
//---------------Test Result -----------------------
Assert.IsTrue(areEquals);
//---------------Tear Down -------------------------
}
示例3: Equals_WhenValuesAreEnumerable_ShouldCompareEnumerables_False
public void Equals_WhenValuesAreEnumerable_ShouldCompareEnumerables_False()
{
//---------------Set up test pack-------------------
const string propName = "IntValue";
Criteria criteria1 = new Criteria(propName, Criteria.ComparisonOp.In, new[] {1, 3, 5});
Criteria criteria2 = new Criteria(propName, Criteria.ComparisonOp.In, new[] { 1, 2, 3, 5 });
//---------------Execute Test ----------------------
bool areEquals = criteria1.Equals(criteria2);
//---------------Test Result -----------------------
Assert.IsFalse(areEquals);
//---------------Tear Down -------------------------
}
示例4: TestEquals_Leaf_FieldValueIsNull_False
public void TestEquals_Leaf_FieldValueIsNull_False()
{
//---------------Set up test pack-------------------
const string datetimePropName = "DateTime";
Criteria criteria1 = new Criteria(datetimePropName, Criteria.ComparisonOp.Equals, null);
Criteria criteria2 = new Criteria(datetimePropName, Criteria.ComparisonOp.Equals, DateTime.Now);
//---------------Execute Test ----------------------
bool areEquals = criteria1.Equals(criteria2);
//---------------Test Result -----------------------
Assert.IsFalse(areEquals);
//---------------Tear Down -------------------------
}