1
1
using System ;
2
- using System . Collections . Generic ;
3
2
using System . Globalization ;
4
3
using System . Linq ;
5
4
using System . Net ;
@@ -91,13 +90,13 @@ public async Task Returns_no_body_for_failed_HEAD_request()
91
90
public async Task Can_get_primary_resources_with_include ( )
92
91
{
93
92
// Arrange
94
- List < Meeting > meetings = _fakers . Meeting . Generate ( 1 ) ;
95
- meetings [ 0 ] . Attendees = _fakers . MeetingAttendee . Generate ( 1 ) ;
93
+ Meeting meeting = _fakers . Meeting . Generate ( ) ;
94
+ meeting . Attendees = _fakers . MeetingAttendee . Generate ( 1 ) ;
96
95
97
96
await _testContext . RunOnDatabaseAsync ( async dbContext =>
98
97
{
99
98
await dbContext . ClearTableAsync < Meeting > ( ) ;
100
- dbContext . Meetings . AddRange ( meetings ) ;
99
+ dbContext . Meetings . Add ( meeting ) ;
101
100
await dbContext . SaveChangesAsync ( ) ;
102
101
} ) ;
103
102
@@ -117,52 +116,52 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
117
116
""data"": [
118
117
{
119
118
""type"": ""meetings"",
120
- ""id"": """ + meetings [ 0 ] . StringId + @""",
119
+ ""id"": """ + meeting . StringId + @""",
121
120
""attributes"": {
122
- ""title"": """ + meetings [ 0 ] . Title + @""",
123
- ""startTime"": """ + meetings [ 0 ] . StartTime . ToString ( JsonDateTimeOffsetFormatSpecifier ) + @""",
124
- ""duration"": """ + meetings [ 0 ] . Duration + @""",
121
+ ""title"": """ + meeting . Title + @""",
122
+ ""startTime"": """ + meeting . StartTime . ToString ( JsonDateTimeOffsetFormatSpecifier ) + @""",
123
+ ""duration"": """ + meeting . Duration + @""",
125
124
""location"": {
126
- ""lat"": " + meetings [ 0 ] . Location . Latitude . ToString ( CultureInfo . InvariantCulture ) + @",
127
- ""lng"": " + meetings [ 0 ] . Location . Longitude . ToString ( CultureInfo . InvariantCulture ) + @"
125
+ ""lat"": " + meeting . Location . Latitude . ToString ( CultureInfo . InvariantCulture ) + @",
126
+ ""lng"": " + meeting . Location . Longitude . ToString ( CultureInfo . InvariantCulture ) + @"
128
127
}
129
128
},
130
129
""relationships"": {
131
130
""attendees"": {
132
131
""links"": {
133
- ""self"": ""http://localhost/meetings/" + meetings [ 0 ] . StringId + @"/relationships/attendees"",
134
- ""related"": ""http://localhost/meetings/" + meetings [ 0 ] . StringId + @"/attendees""
132
+ ""self"": ""http://localhost/meetings/" + meeting . StringId + @"/relationships/attendees"",
133
+ ""related"": ""http://localhost/meetings/" + meeting . StringId + @"/attendees""
135
134
},
136
135
""data"": [
137
136
{
138
137
""type"": ""meetingAttendees"",
139
- ""id"": """ + meetings [ 0 ] . Attendees [ 0 ] . StringId + @"""
138
+ ""id"": """ + meeting . Attendees [ 0 ] . StringId + @"""
140
139
}
141
140
]
142
141
}
143
142
},
144
143
""links"": {
145
- ""self"": ""http://localhost/meetings/" + meetings [ 0 ] . StringId + @"""
144
+ ""self"": ""http://localhost/meetings/" + meeting . StringId + @"""
146
145
}
147
146
}
148
147
],
149
148
""included"": [
150
149
{
151
150
""type"": ""meetingAttendees"",
152
- ""id"": """ + meetings [ 0 ] . Attendees [ 0 ] . StringId + @""",
151
+ ""id"": """ + meeting . Attendees [ 0 ] . StringId + @""",
153
152
""attributes"": {
154
- ""displayName"": """ + meetings [ 0 ] . Attendees [ 0 ] . DisplayName + @"""
153
+ ""displayName"": """ + meeting . Attendees [ 0 ] . DisplayName + @"""
155
154
},
156
155
""relationships"": {
157
156
""meeting"": {
158
157
""links"": {
159
- ""self"": ""http://localhost/meetingAttendees/" + meetings [ 0 ] . Attendees [ 0 ] . StringId + @"/relationships/meeting"",
160
- ""related"": ""http://localhost/meetingAttendees/" + meetings [ 0 ] . Attendees [ 0 ] . StringId + @"/meeting""
158
+ ""self"": ""http://localhost/meetingAttendees/" + meeting . Attendees [ 0 ] . StringId + @"/relationships/meeting"",
159
+ ""related"": ""http://localhost/meetingAttendees/" + meeting . Attendees [ 0 ] . StringId + @"/meeting""
161
160
}
162
161
}
163
162
},
164
163
""links"": {
165
- ""self"": ""http://localhost/meetingAttendees/" + meetings [ 0 ] . Attendees [ 0 ] . StringId + @"""
164
+ ""self"": ""http://localhost/meetingAttendees/" + meeting . Attendees [ 0 ] . StringId + @"""
166
165
}
167
166
}
168
167
]
@@ -173,12 +172,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
173
172
public async Task Can_get_primary_resources_with_empty_include ( )
174
173
{
175
174
// Arrange
176
- List < Meeting > meetings = _fakers . Meeting . Generate ( 1 ) ;
175
+ Meeting meeting = _fakers . Meeting . Generate ( ) ;
177
176
178
177
await _testContext . RunOnDatabaseAsync ( async dbContext =>
179
178
{
180
179
await dbContext . ClearTableAsync < Meeting > ( ) ;
181
- dbContext . Meetings . AddRange ( meetings ) ;
180
+ dbContext . Meetings . Add ( meeting ) ;
182
181
await dbContext . SaveChangesAsync ( ) ;
183
182
} ) ;
184
183
@@ -198,27 +197,27 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
198
197
""data"": [
199
198
{
200
199
""type"": ""meetings"",
201
- ""id"": """ + meetings [ 0 ] . StringId + @""",
200
+ ""id"": """ + meeting . StringId + @""",
202
201
""attributes"": {
203
- ""title"": """ + meetings [ 0 ] . Title + @""",
204
- ""startTime"": """ + meetings [ 0 ] . StartTime . ToString ( JsonDateTimeOffsetFormatSpecifier ) + @""",
205
- ""duration"": """ + meetings [ 0 ] . Duration + @""",
202
+ ""title"": """ + meeting . Title + @""",
203
+ ""startTime"": """ + meeting . StartTime . ToString ( JsonDateTimeOffsetFormatSpecifier ) + @""",
204
+ ""duration"": """ + meeting . Duration + @""",
206
205
""location"": {
207
- ""lat"": " + meetings [ 0 ] . Location . Latitude . ToString ( CultureInfo . InvariantCulture ) + @",
208
- ""lng"": " + meetings [ 0 ] . Location . Longitude . ToString ( CultureInfo . InvariantCulture ) + @"
206
+ ""lat"": " + meeting . Location . Latitude . ToString ( CultureInfo . InvariantCulture ) + @",
207
+ ""lng"": " + meeting . Location . Longitude . ToString ( CultureInfo . InvariantCulture ) + @"
209
208
}
210
209
},
211
210
""relationships"": {
212
211
""attendees"": {
213
212
""links"": {
214
- ""self"": ""http://localhost/meetings/" + meetings [ 0 ] . StringId + @"/relationships/attendees"",
215
- ""related"": ""http://localhost/meetings/" + meetings [ 0 ] . StringId + @"/attendees""
213
+ ""self"": ""http://localhost/meetings/" + meeting . StringId + @"/relationships/attendees"",
214
+ ""related"": ""http://localhost/meetings/" + meeting . StringId + @"/attendees""
216
215
},
217
216
""data"": []
218
217
}
219
218
},
220
219
""links"": {
221
- ""self"": ""http://localhost/meetings/" + meetings [ 0 ] . StringId + @"""
220
+ ""self"": ""http://localhost/meetings/" + meeting . StringId + @"""
222
221
}
223
222
}
224
223
],
0 commit comments