mirror of
https://github.com/Biarity/Sieve.git
synced 2025-09-21 07:39:46 +02:00
Boolean sorting & filtering tests
This commit is contained in:
@@ -27,12 +27,14 @@ namespace SieveUnitTests
|
||||
new Post() {
|
||||
Id = 0,
|
||||
Title = "A",
|
||||
LikeCount = 100
|
||||
LikeCount = 100,
|
||||
IsDraft = true
|
||||
},
|
||||
new Post() {
|
||||
Id = 1,
|
||||
Title = "B",
|
||||
LikeCount = 50
|
||||
LikeCount = 50,
|
||||
IsDraft = false
|
||||
},
|
||||
new Post() {
|
||||
Id = 2,
|
||||
@@ -69,6 +71,33 @@ namespace SieveUnitTests
|
||||
Assert.IsTrue(result.Count() == 0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CanFilterBools()
|
||||
{
|
||||
var model = new SieveModel()
|
||||
{
|
||||
Filters = "IsDraft==false"
|
||||
};
|
||||
|
||||
var result = _processor.ApplyAll(model, _posts);
|
||||
|
||||
Assert.IsTrue(result.Count() == 2);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void CanSortBools()
|
||||
{
|
||||
var model = new SieveModel()
|
||||
{
|
||||
Sorts = "-IsDraft"
|
||||
};
|
||||
|
||||
var result = _processor.ApplyAll(model, _posts);
|
||||
|
||||
Assert.AreEqual(result.First().Id, 0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EqualsDoesntFailWithNonStringTypes()
|
||||
{
|
||||
|
Reference in New Issue
Block a user