Skip to content

Commit 5002420

Browse files
committed
Cancellation tokens and params do not work well.
Ping @maca88
1 parent cd7bae7 commit 5002420

File tree

1 file changed

+88
-88
lines changed

1 file changed

+88
-88
lines changed

src/NHibernate.Test/Async/Linq/NullComparisonTests.cs

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
namespace NHibernate.Test.Linq
2020
{
2121
using System.Threading.Tasks;
22-
using System.Threading;
22+
2323
[TestFixture]
2424
public class NullComparisonTestsAsync : LinqTestCase
2525
{
@@ -36,67 +36,67 @@ public async Task NullEqualityAsync()
3636
string nullVariable2 = null;
3737
string notNullVariable = "input";
3838

39-
Assert.AreEqual(5, (await (session.CreateCriteria<AnotherEntity>().ListAsync<AnotherEntity>(CancellationToken.None))).Count);
39+
Assert.AreEqual(5, (await (session.CreateCriteria<AnotherEntity>().ListAsync<AnotherEntity>())).Count);
4040

4141
IQueryable<AnotherEntity> q;
4242

4343
// Null literal against itself
4444
q = from x in session.Query<AnotherEntity>() where null == null select x;
45-
await (ExpectAllAsync(q, CancellationToken.None));
45+
await (ExpectAllAsync(q));
4646

4747
// Null against constants
4848
q = from x in session.Query<AnotherEntity>() where null == "value" select x;
49-
await (ExpectNoneAsync(q, CancellationToken.None));
49+
await (ExpectNoneAsync(q));
5050
q = from x in session.Query<AnotherEntity>() where "value" == null select x;
51-
await (ExpectNoneAsync(q, CancellationToken.None));
51+
await (ExpectNoneAsync(q));
5252

5353
// Null against variables
5454
q = from x in session.Query<AnotherEntity>() where null == nullVariable select x;
55-
await (ExpectAllAsync(q, CancellationToken.None));
55+
await (ExpectAllAsync(q));
5656
q = from x in session.Query<AnotherEntity>() where null == notNullVariable select x;
57-
await (ExpectNoneAsync(q, CancellationToken.None));
57+
await (ExpectNoneAsync(q));
5858
q = from x in session.Query<AnotherEntity>() where nullVariable == null select x;
59-
await (ExpectAllAsync(q, CancellationToken.None));
59+
await (ExpectAllAsync(q));
6060
q = from x in session.Query<AnotherEntity>() where notNullVariable == null select x;
61-
await (ExpectNoneAsync(q, CancellationToken.None));
61+
await (ExpectNoneAsync(q));
6262

6363
// Null against columns
6464
q = from x in session.Query<AnotherEntity>() where x.Input == null select x;
65-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
65+
await (ExpectInputIsNullAsync(q));
6666
q = from x in session.Query<AnotherEntity>() where null == x.Input select x;
67-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
67+
await (ExpectInputIsNullAsync(q));
6868

6969
// All null pairings with two columns.
7070
q = from x in session.Query<AnotherEntity>() where x.Input == null && x.Output == null select x;
71-
await (ExpectAsync(q, BothNull, CancellationToken.None));
71+
await (ExpectAsync(q, BothNull));
7272
q = from x in session.Query<AnotherEntity>() where x.Input != null && x.Output == null select x;
73-
await (ExpectAsync(q, InputSet, CancellationToken.None));
73+
await (ExpectAsync(q, InputSet));
7474
q = from x in session.Query<AnotherEntity>() where x.Input == null && x.Output != null select x;
75-
await (ExpectAsync(q, OutputSet, CancellationToken.None));
75+
await (ExpectAsync(q, OutputSet));
7676
q = from x in session.Query<AnotherEntity>() where x.Input != null && x.Output != null select x;
77-
await (ExpectAsync(q, BothSame, BothDifferent, CancellationToken.None));
77+
await (ExpectAsync(q, BothSame));
7878

7979
// Variables against variables
8080
q = from x in session.Query<AnotherEntity>() where nullVariable == nullVariable2 select x;
81-
await (ExpectAllAsync(q, CancellationToken.None));
81+
await (ExpectAllAsync(q));
8282
q = from x in session.Query<AnotherEntity>() where nullVariable == notNullVariable select x;
83-
await (ExpectNoneAsync(q, CancellationToken.None));
83+
await (ExpectNoneAsync(q));
8484
q = from x in session.Query<AnotherEntity>() where notNullVariable == nullVariable select x;
85-
await (ExpectNoneAsync(q, CancellationToken.None));
85+
await (ExpectNoneAsync(q));
8686

8787
//// Variables against columns
8888
q = from x in session.Query<AnotherEntity>() where nullVariable == x.Input select x;
89-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
89+
await (ExpectInputIsNullAsync(q));
9090
q = from x in session.Query<AnotherEntity>() where notNullVariable == x.Input select x;
91-
await (ExpectAsync(q, InputSet, BothDifferent, CancellationToken.None));
91+
await (ExpectAsync(q, InputSet));
9292
q = from x in session.Query<AnotherEntity>() where x.Input == nullVariable select x;
93-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
93+
await (ExpectInputIsNullAsync(q));
9494
q = from x in session.Query<AnotherEntity>() where x.Input == notNullVariable select x;
95-
await (ExpectAsync(q, InputSet, BothDifferent, CancellationToken.None));
95+
await (ExpectAsync(q, InputSet));
9696

9797
// Columns against columns
9898
q = from x in session.Query<AnotherEntity>() where x.Input == x.Output select x;
99-
await (ExpectAsync(q, BothSame, BothNull, CancellationToken.None));
99+
await (ExpectAsync(q, BothSame));
100100
}
101101

102102
[Test]
@@ -110,51 +110,51 @@ public async Task NullInequalityAsync()
110110

111111
// Null literal against itself
112112
q = from x in session.Query<AnotherEntity>() where null != null select x;
113-
await (ExpectNoneAsync(q, CancellationToken.None));
113+
await (ExpectNoneAsync(q));
114114

115115
// Null against constants
116116
q = from x in session.Query<AnotherEntity>() where null != "value" select x;
117-
await (ExpectAllAsync(q, CancellationToken.None));
117+
await (ExpectAllAsync(q));
118118
q = from x in session.Query<AnotherEntity>() where "value" != null select x;
119-
await (ExpectAllAsync(q, CancellationToken.None));
119+
await (ExpectAllAsync(q));
120120

121121
// Null against variables
122122
q = from x in session.Query<AnotherEntity>() where null != nullVariable select x;
123-
await (ExpectNoneAsync(q, CancellationToken.None));
123+
await (ExpectNoneAsync(q));
124124
q = from x in session.Query<AnotherEntity>() where null != notNullVariable select x;
125-
await (ExpectAllAsync(q, CancellationToken.None));
125+
await (ExpectAllAsync(q));
126126
q = from x in session.Query<AnotherEntity>() where nullVariable != null select x;
127-
await (ExpectNoneAsync(q, CancellationToken.None));
127+
await (ExpectNoneAsync(q));
128128
q = from x in session.Query<AnotherEntity>() where notNullVariable != null select x;
129-
await (ExpectAllAsync(q, CancellationToken.None));
129+
await (ExpectAllAsync(q));
130130

131131
// Null against columns.
132132
q = from x in session.Query<AnotherEntity>() where x.Input != null select x;
133-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
133+
await (ExpectInputIsNotNullAsync(q));
134134
q = from x in session.Query<AnotherEntity>() where null != x.Input select x;
135-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
135+
await (ExpectInputIsNotNullAsync(q));
136136

137137
// Variables against variables.
138138
q = from x in session.Query<AnotherEntity>() where nullVariable != nullVariable2 select x;
139-
await (ExpectNoneAsync(q, CancellationToken.None));
139+
await (ExpectNoneAsync(q));
140140
q = from x in session.Query<AnotherEntity>() where nullVariable != notNullVariable select x;
141-
await (ExpectAllAsync(q, CancellationToken.None));
141+
await (ExpectAllAsync(q));
142142
q = from x in session.Query<AnotherEntity>() where notNullVariable != nullVariable select x;
143-
await (ExpectAllAsync(q, CancellationToken.None));
143+
await (ExpectAllAsync(q));
144144

145145
// Variables against columns.
146146
q = from x in session.Query<AnotherEntity>() where nullVariable != x.Input select x;
147-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
147+
await (ExpectInputIsNotNullAsync(q));
148148
q = from x in session.Query<AnotherEntity>() where notNullVariable != x.Input select x;
149-
await (ExpectAsync(q, BothSame, BothNull, OutputSet, CancellationToken.None));
149+
await (ExpectAsync(q, BothSame, OutputSet));
150150
q = from x in session.Query<AnotherEntity>() where x.Input != nullVariable select x;
151-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
151+
await (ExpectInputIsNotNullAsync(q));
152152
q = from x in session.Query<AnotherEntity>() where x.Input != notNullVariable select x;
153-
await (ExpectAsync(q, BothSame, OutputSet, BothNull, CancellationToken.None));
153+
await (ExpectAsync(q, BothSame, BothNull));
154154

155155
// Columns against columns
156156
q = from x in session.Query<AnotherEntity>() where x.Input != x.Output select x;
157-
await (ExpectAsync(q, BothDifferent, InputSet, OutputSet, CancellationToken.None));
157+
await (ExpectAsync(q, BothDifferent, OutputSet));
158158
}
159159

160160
[Test]
@@ -168,61 +168,61 @@ public async Task NullEqualityInvertedAsync()
168168

169169
// Null literal against itself
170170
q = from x in session.Query<AnotherEntity>() where !(null == null) select x;
171-
await (ExpectNoneAsync(q, CancellationToken.None));
171+
await (ExpectNoneAsync(q));
172172

173173
// Null against constants
174174
q = from x in session.Query<AnotherEntity>() where !(null == "value") select x;
175-
await (ExpectAllAsync(q, CancellationToken.None));
175+
await (ExpectAllAsync(q));
176176
q = from x in session.Query<AnotherEntity>() where !("value" == null) select x;
177-
await (ExpectAllAsync(q, CancellationToken.None));
177+
await (ExpectAllAsync(q));
178178

179179
// Null against variables
180180
q = from x in session.Query<AnotherEntity>() where !(null == nullVariable) select x;
181-
await (ExpectNoneAsync(q, CancellationToken.None));
181+
await (ExpectNoneAsync(q));
182182
q = from x in session.Query<AnotherEntity>() where !(null == notNullVariable) select x;
183-
await (ExpectAllAsync(q, CancellationToken.None));
183+
await (ExpectAllAsync(q));
184184
q = from x in session.Query<AnotherEntity>() where !(nullVariable == null) select x;
185-
await (ExpectNoneAsync(q, CancellationToken.None));
185+
await (ExpectNoneAsync(q));
186186
q = from x in session.Query<AnotherEntity>() where !(notNullVariable == null) select x;
187-
await (ExpectAllAsync(q, CancellationToken.None));
187+
await (ExpectAllAsync(q));
188188

189189
// Null against columns
190190
q = from x in session.Query<AnotherEntity>() where !(x.Input == null) select x;
191-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
191+
await (ExpectInputIsNotNullAsync(q));
192192
q = from x in session.Query<AnotherEntity>() where !(null == x.Input) select x;
193-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
193+
await (ExpectInputIsNotNullAsync(q));
194194

195195
// All null pairings with two columns.
196196
q = from x in session.Query<AnotherEntity>() where !(x.Input == null && x.Output == null) select x;
197-
await (ExpectAsync(q, InputSet, OutputSet, BothSame, BothDifferent, CancellationToken.None));
197+
await (ExpectAsync(q, InputSet, BothSame, BothDifferent));
198198
q = from x in session.Query<AnotherEntity>() where !(x.Input != null && x.Output == null) select x;
199-
await (ExpectAsync(q, OutputSet, BothNull, BothSame, BothDifferent, CancellationToken.None));
199+
await (ExpectAsync(q, OutputSet, BothSame, BothDifferent));
200200
q = from x in session.Query<AnotherEntity>() where !(x.Input == null && x.Output != null) select x;
201-
await (ExpectAsync(q, InputSet, BothSame, BothDifferent, BothNull, CancellationToken.None));
201+
await (ExpectAsync(q, InputSet, BothDifferent, BothNull));
202202
q = from x in session.Query<AnotherEntity>() where !(x.Input != null && x.Output != null) select x;
203-
await (ExpectAsync(q, InputSet, OutputSet, BothNull, CancellationToken.None));
203+
await (ExpectAsync(q, InputSet, BothNull));
204204

205205
// Variables against variables
206206
q = from x in session.Query<AnotherEntity>() where !(nullVariable == nullVariable2) select x;
207-
await (ExpectNoneAsync(q, CancellationToken.None));
207+
await (ExpectNoneAsync(q));
208208
q = from x in session.Query<AnotherEntity>() where !(nullVariable == notNullVariable) select x;
209-
await (ExpectAllAsync(q, CancellationToken.None));
209+
await (ExpectAllAsync(q));
210210
q = from x in session.Query<AnotherEntity>() where !(notNullVariable == nullVariable) select x;
211-
await (ExpectAllAsync(q, CancellationToken.None));
211+
await (ExpectAllAsync(q));
212212

213213
// Variables against columns
214214
q = from x in session.Query<AnotherEntity>() where !(nullVariable == x.Input) select x;
215-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
215+
await (ExpectInputIsNotNullAsync(q));
216216
q = from x in session.Query<AnotherEntity>() where !(notNullVariable == x.Input) select x;
217-
await (ExpectAsync(q, BothSame, CancellationToken.None));
217+
await (ExpectAsync(q, BothSame));
218218
q = from x in session.Query<AnotherEntity>() where !(x.Input == nullVariable) select x;
219-
await (ExpectInputIsNotNullAsync(q, CancellationToken.None));
219+
await (ExpectInputIsNotNullAsync(q));
220220
q = from x in session.Query<AnotherEntity>() where !(x.Input == notNullVariable) select x;
221-
await (ExpectAsync(q, BothSame, CancellationToken.None));
221+
await (ExpectAsync(q, BothSame));
222222

223223
// Columns against columns
224224
q = from x in session.Query<AnotherEntity>() where !(x.Input == x.Output) select x;
225-
await (ExpectAsync(q, BothDifferent, CancellationToken.None));
225+
await (ExpectAsync(q, BothDifferent));
226226
}
227227

228228
[Test]
@@ -236,76 +236,76 @@ public async Task NullInequalityInvertedAsync()
236236

237237
// Null literal against itself
238238
q = from x in session.Query<AnotherEntity>() where !(null != null) select x;
239-
await (ExpectAllAsync(q, CancellationToken.None));
239+
await (ExpectAllAsync(q));
240240

241241
// Null against constants
242242
q = from x in session.Query<AnotherEntity>() where !(null != "value") select x;
243-
await (ExpectNoneAsync(q, CancellationToken.None));
243+
await (ExpectNoneAsync(q));
244244
q = from x in session.Query<AnotherEntity>() where !("value" != null) select x;
245-
await (ExpectNoneAsync(q, CancellationToken.None));
245+
await (ExpectNoneAsync(q));
246246

247247
// Null against variables
248248
q = from x in session.Query<AnotherEntity>() where !(null != nullVariable) select x;
249-
await (ExpectAllAsync(q, CancellationToken.None));
249+
await (ExpectAllAsync(q));
250250
q = from x in session.Query<AnotherEntity>() where !(null != notNullVariable) select x;
251-
await (ExpectNoneAsync(q, CancellationToken.None));
251+
await (ExpectNoneAsync(q));
252252
q = from x in session.Query<AnotherEntity>() where !(nullVariable != null) select x;
253-
await (ExpectAllAsync(q, CancellationToken.None));
253+
await (ExpectAllAsync(q));
254254
q = from x in session.Query<AnotherEntity>() where !(notNullVariable != null) select x;
255-
await (ExpectNoneAsync(q, CancellationToken.None));
255+
await (ExpectNoneAsync(q));
256256

257257
// Null against columns.
258258
q = from x in session.Query<AnotherEntity>() where !(x.Input != null) select x;
259-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
259+
await (ExpectInputIsNullAsync(q));
260260
q = from x in session.Query<AnotherEntity>() where !(null != x.Input) select x;
261-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
261+
await (ExpectInputIsNullAsync(q));
262262

263263
// Variables against variables.
264264
q = from x in session.Query<AnotherEntity>() where !(nullVariable != nullVariable2) select x;
265-
await (ExpectAllAsync(q, CancellationToken.None));
265+
await (ExpectAllAsync(q));
266266
q = from x in session.Query<AnotherEntity>() where !(nullVariable != notNullVariable) select x;
267-
await (ExpectNoneAsync(q, CancellationToken.None));
267+
await (ExpectNoneAsync(q));
268268
q = from x in session.Query<AnotherEntity>() where !(notNullVariable != nullVariable) select x;
269-
await (ExpectNoneAsync(q, CancellationToken.None));
269+
await (ExpectNoneAsync(q));
270270

271271
// Variables against columns.
272272
q = from x in session.Query<AnotherEntity>() where !(nullVariable != x.Input) select x;
273-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
273+
await (ExpectInputIsNullAsync(q));
274274
q = from x in session.Query<AnotherEntity>() where !(notNullVariable != x.Input) select x;
275-
await (ExpectAsync(q, InputSet, BothDifferent, CancellationToken.None));
275+
await (ExpectAsync(q, InputSet));
276276
q = from x in session.Query<AnotherEntity>() where !(x.Input != nullVariable) select x;
277-
await (ExpectInputIsNullAsync(q, CancellationToken.None));
277+
await (ExpectInputIsNullAsync(q));
278278
q = from x in session.Query<AnotherEntity>() where !(x.Input != notNullVariable) select x;
279-
await (ExpectAsync(q, InputSet, BothDifferent, CancellationToken.None));
279+
await (ExpectAsync(q, InputSet));
280280

281281
// Columns against columns
282282
q = from x in session.Query<AnotherEntity>() where !(x.Input != x.Output) select x;
283-
await (ExpectAsync(q, BothSame, CancellationToken.None));
283+
await (ExpectAsync(q, BothSame));
284284
}
285285

286-
private Task ExpectAllAsync(IQueryable<AnotherEntity> q, CancellationToken cancellationToken = default(CancellationToken))
286+
private Task ExpectAllAsync(IQueryable<AnotherEntity> q)
287287
{
288-
return ExpectAsync(q, BothNull, BothSame, BothDifferent, InputSet, OutputSet, cancellationToken);
288+
return ExpectAsync(q, BothNull, BothSame, BothDifferent, InputSet, OutputSet);
289289
}
290290

291-
private Task ExpectNoneAsync(IQueryable<AnotherEntity> q, CancellationToken cancellationToken = default(CancellationToken))
291+
private Task ExpectNoneAsync(IQueryable<AnotherEntity> q)
292292
{
293-
return ExpectAsync(q, cancellationToken:cancellationToken);
293+
return ExpectAsync(q);
294294
}
295295

296-
private Task ExpectInputIsNullAsync(IQueryable<AnotherEntity> q, CancellationToken cancellationToken = default(CancellationToken))
296+
private Task ExpectInputIsNullAsync(IQueryable<AnotherEntity> q)
297297
{
298-
return ExpectAsync(q, BothNull, OutputSet, cancellationToken);
298+
return ExpectAsync(q, BothNull, OutputSet);
299299
}
300300

301-
private Task ExpectInputIsNotNullAsync(IQueryable<AnotherEntity> q, CancellationToken cancellationToken = default(CancellationToken))
301+
private Task ExpectInputIsNotNullAsync(IQueryable<AnotherEntity> q)
302302
{
303-
return ExpectAsync(q, InputSet, BothSame, BothDifferent, cancellationToken);
303+
return ExpectAsync(q, InputSet, BothSame, BothDifferent);
304304
}
305305

306-
private async Task ExpectAsync(IQueryable<AnotherEntity> q, params AnotherEntity[] entities, CancellationToken cancellationToken = default(CancellationToken))
306+
private async Task ExpectAsync(IQueryable<AnotherEntity> q, params AnotherEntity[] entities)
307307
{
308-
IList<AnotherEntity> results = (await (q.ToListAsync(cancellationToken))).OrderBy(l=> Key(l)).ToList();
308+
IList<AnotherEntity> results = (await (q.ToListAsync())).OrderBy(l=> Key(l)).ToList();
309309
IList<AnotherEntity> check = entities.OrderBy(l => Key(l)).ToList();
310310

311311
Assert.AreEqual(check.Count, results.Count);

0 commit comments

Comments
 (0)