all tests are passing, negate and not contains feature.
This commit is contained in:
parent
84e111ee80
commit
c45ff785bc
@ -180,7 +180,7 @@ namespace PoweredSoft.DynamicLinq.Test
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void NotContains()
|
||||
public void NotContains2()
|
||||
{
|
||||
var q1 = Persons.AsQueryable().Query(t => t.NotContains("LastName", "ee"));
|
||||
var q1b = Persons.AsQueryable().Where(t => !t.LastName.Contains("ee"));
|
||||
|
@ -76,6 +76,22 @@ namespace PoweredSoft.DynamicLinq.Test
|
||||
QueryableAssert.AreEqual(a, b, "CaseInsensitive");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void NegateNotContains()
|
||||
{
|
||||
IQueryable<MockPersonObject> a, b;
|
||||
|
||||
// case sensitive.
|
||||
a = Persons.AsQueryable().Query(t => t.NotContains("FirstName", "vi", stringComparision: null, negate: true));
|
||||
b = Persons.AsQueryable().Where(t => !!t.FirstName.Contains("vi"));
|
||||
QueryableAssert.AreEqual(a, b, "CaseSensitive");
|
||||
|
||||
// not case sensitive
|
||||
a = Persons.AsQueryable().Query(t => t.NotContains("FirstName", "VI", stringComparision: StringComparison.OrdinalIgnoreCase, negate: true));
|
||||
b = Persons.AsQueryable().Where(t => !(t.FirstName.IndexOf("VI", StringComparison.OrdinalIgnoreCase) == -1));
|
||||
QueryableAssert.AreEqual(a, b, "CaseInsensitive");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StartsWith()
|
||||
{
|
||||
|
@ -98,14 +98,14 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
||||
#endregion
|
||||
|
||||
#region not contains
|
||||
public WhereBuilder NotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
=> And(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
public WhereBuilder NotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null, bool negate = false)
|
||||
=> And(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision, negate: negate);
|
||||
|
||||
public WhereBuilder AndNotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
=> And(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
public WhereBuilder AndNotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null, bool negate = false)
|
||||
=> And(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision, negate: negate);
|
||||
|
||||
public WhereBuilder OrNotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
=> Or(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
public WhereBuilder OrNotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null, bool negate = false)
|
||||
=> Or(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision, negate: negate);
|
||||
#endregion
|
||||
|
||||
#region starts with
|
||||
|
Loading…
Reference in New Issue
Block a user