mirror of
https://github.com/Biarity/Sieve.git
synced 2024-11-22 13:32:33 +01:00
Boolean sorting & filtering tests
This commit is contained in:
parent
9104ea7693
commit
47fd6307a0
@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Sieve</id>
|
||||
<version>1.3.92</version>
|
||||
<version>1.3.93</version>
|
||||
<title>Sieve</title>
|
||||
<authors>Biarity</authors>
|
||||
<owners>Biarity</owners>
|
||||
@ -13,7 +13,7 @@
|
||||
<description>
|
||||
Sieve is a simple, clean, and extensible framework for .NET Core that adds sorting, filtering, and pagination functionality out of the box. Most common use case would be for serving ASP.NET Core GET queries. Documentation available on GitHub: https://github.com/Biarity/Sieve/
|
||||
</description>
|
||||
<releaseNotes>Base exception type, max pages feature</releaseNotes>
|
||||
<releaseNotes>Fix parse order</releaseNotes>
|
||||
<copyright>Copyright 2018</copyright>
|
||||
<tags>aspnetcore filter sort page paginate sieve search</tags>
|
||||
<dependencies>
|
||||
|
@ -22,6 +22,9 @@ namespace SieveUnitTests.Entities
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public DateTimeOffset DateCreated { get; set; } = DateTimeOffset.UtcNow;
|
||||
|
||||
[Sieve(CanFilter = true, CanSort = true)]
|
||||
public bool IsDraft { get; set; }
|
||||
|
||||
public string ThisHasNoAttribute { get; set; }
|
||||
|
||||
public string ThisHasNoAttributeButIsAccessible { get; set; }
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
### 1. Pack:
|
||||
```
|
||||
dotnet pack Sieve.csproj -c Release -o . /p:PackageVersion=1.3.92
|
||||
dotnet pack Sieve.csproj -c Release -o . /p:PackageVersion=1.3.93
|
||||
```
|
||||
Don't forget to change version since nuget packages are immutable (add one to the nuget current).
|
||||
|
||||
@ -13,7 +13,7 @@ Also don't forget updaing `releaseNotes` in nuspec.
|
||||
|
||||
### 3. Publish:
|
||||
```
|
||||
nuget push Sieve.1.3.92.nupkg API_KEY -Source https://api.nuget.org/v3/index.json
|
||||
nuget push Sieve.1.3.93.nupkg API_KEY -Source https://api.nuget.org/v3/index.json
|
||||
```
|
||||
Replace API_KEY with one you get from nuget's website.
|
||||
Also don't forget to replace corresponding version.
|
||||
|
Loading…
Reference in New Issue
Block a user