mirror of
https://github.com/Biarity/Sieve.git
synced 2024-11-21 21:12:50 +01:00
Merge pull request #74 from skolmer/caseinsensitive-unequal
Case insensitive not-equal operator
This commit is contained in:
commit
ee10db4baa
@ -192,6 +192,7 @@ You can replace this DSL with your own (eg. use JSON instead) by implementing an
|
|||||||
| `@=*` | Case-insensitive string Contains |
|
| `@=*` | Case-insensitive string Contains |
|
||||||
| `_=*` | Case-insensitive string Starts with |
|
| `_=*` | Case-insensitive string Starts with |
|
||||||
| `==*` | Case-insensitive string Equals |
|
| `==*` | Case-insensitive string Equals |
|
||||||
|
| `!=*` | Case-insensitive string Not equals |
|
||||||
| `!@=*` | Case-insensitive string does not Contains |
|
| `!@=*` | Case-insensitive string does not Contains |
|
||||||
| `!_=*` | Case-insensitive string does not Starts with |
|
| `!_=*` | Case-insensitive string does not Starts with |
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ namespace Sieve.Models
|
|||||||
private static readonly string[] Operators = new string[] {
|
private static readonly string[] Operators = new string[] {
|
||||||
"!@=*",
|
"!@=*",
|
||||||
"!_=*",
|
"!_=*",
|
||||||
|
"!=*",
|
||||||
"!@=",
|
"!@=",
|
||||||
"!_=",
|
"!_=",
|
||||||
"==*",
|
"==*",
|
||||||
|
@ -96,6 +96,20 @@ namespace SieveUnitTests
|
|||||||
Assert.IsTrue(result.Count() == 1);
|
Assert.IsTrue(result.Count() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void NotEqualsCanBeCaseInsensitive()
|
||||||
|
{
|
||||||
|
var model = new SieveModel()
|
||||||
|
{
|
||||||
|
Filters = "Title!=*a"
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = _processor.Apply(model, _posts);
|
||||||
|
|
||||||
|
Assert.AreEqual(result.First().Id, 1);
|
||||||
|
Assert.IsTrue(result.Count() == 3);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ContainsIsCaseSensitive()
|
public void ContainsIsCaseSensitive()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user