File tree Expand file tree Collapse file tree 3 files changed +67
-0
lines changed
src/Examples/JsonApiDotNetCoreExample/Models
test/JsonApiDotNetCoreExampleTests/Acceptance Expand file tree Collapse file tree 3 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -75,3 +75,41 @@ public class Startup
75
75
}
76
76
}
77
77
```
78
+
79
+ ### Development
80
+
81
+ Restore all nuget packages with:
82
+
83
+ ``` bash
84
+ dotnet restore
85
+ ```
86
+
87
+ #### Testing
88
+
89
+ Running tests locally requires access to a postgresql database.
90
+ If you have docker installed, this can be propped up via:
91
+
92
+ ``` bash
93
+ docker run --rm --name jsonapi-dotnet-core-testing \
94
+ -e POSTGRES_DB=JsonApiDotNetCoreExample \
95
+ -e POSTGRES_USER=postgres \
96
+ -e POSTGRES_PASSWORD=postgres \
97
+ -p 5432:5432 \
98
+ postgres
99
+ ```
100
+
101
+ And then to run the tests:
102
+
103
+ ``` bash
104
+ dotnet test
105
+ ```
106
+
107
+ #### Cleaning
108
+
109
+ Sometimes the compiled files can be dirty / corrupt from other branches / failed builds.
110
+ If your bash prompt supports the globstar, you can recursively delete the ` bin ` and ` obj ` directories:
111
+
112
+ ``` bash
113
+ shopt -s globstar
114
+ rm -rf ** /bin && rm -rf ** /obj
115
+ ```
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ public TodoItem()
24
24
25
25
[ Attr ( "achieved-date" , isFilterable : false , isSortable : false ) ]
26
26
public DateTime ? AchievedDate { get ; set ; }
27
+
28
+
29
+ [ Attr ( "updated-date" ) ]
30
+ public DateTime ? UpdatedDate { get ; set ; }
31
+
32
+
27
33
28
34
public int ? OwnerId { get ; set ; }
29
35
public int ? AssigneeId { get ; set ; }
Original file line number Diff line number Diff line change @@ -90,6 +90,29 @@ public async Task Can_Filter_TodoItems()
90
90
Assert . Equal ( todoItem . Ordinal , todoItemResult . Ordinal ) ;
91
91
}
92
92
93
+ [ Fact ]
94
+ public async Task Can_Filter_TodoItems_Using_NotEqual_Operator ( )
95
+ {
96
+ // Arrange
97
+ var todoItem = _todoItemFaker . Generate ( ) ;
98
+ todoItem . UpdatedDate = null ;
99
+ _context . TodoItems . Add ( todoItem ) ;
100
+ _context . SaveChanges ( ) ;
101
+
102
+ var httpMethod = new HttpMethod ( "GET" ) ;
103
+ var route = $ "/api/v1/todo-items?filter[updated-date]=ne:null";
104
+ var request = new HttpRequestMessage ( httpMethod , route ) ;
105
+
106
+ // Act
107
+ var response = await _fixture . Client . SendAsync ( request ) ;
108
+ var body = await response . Content . ReadAsStringAsync ( ) ;
109
+ var deserializedBody = _fixture . GetService < IJsonApiDeSerializer > ( ) . DeserializeList < TodoItem > ( body ) ;
110
+
111
+ // Assert
112
+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
113
+ Assert . Empty ( deserializedBody ) ;
114
+ }
115
+
93
116
[ Fact ]
94
117
public async Task Can_Filter_TodoItems_Using_Like_Operator ( )
95
118
{
You can’t perform that action at this time.
0 commit comments