|
12 | 12 | using System.Collections.Generic;
|
13 | 13 | using System.Linq;
|
14 | 14 | using System.Text;
|
| 15 | +using NHibernate.Dialect; |
15 | 16 | using NHibernate.Linq;
|
16 | 17 | using NHibernate.DomainModel.Northwind.Entities;
|
17 | 18 | using NUnit.Framework;
|
@@ -472,6 +473,33 @@ public async Task NullEqualityAsync()
|
472 | 473 |
|
473 | 474 | await (ExpectAsync(session.Query<User>().Where(o => o.CreatedBy.ModifiedBy.Id == 5), Does.Not.Contain("is null").IgnoreCase));
|
474 | 475 | await (ExpectAsync(session.Query<User>().Where(o => 5 == o.CreatedBy.ModifiedBy.Id), Does.Not.Contain("is null").IgnoreCase));
|
| 476 | + |
| 477 | + if (Sfi.Dialect is FirebirdDialect) |
| 478 | + { |
| 479 | + return; |
| 480 | + } |
| 481 | + |
| 482 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort == o.NullableShort), WithIsNullAndWithoutCast())); |
| 483 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short == o.Short), WithoutIsNullAndWithoutCast())); |
| 484 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort == o.Short), WithoutIsNullAndWithoutCast())); |
| 485 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short == o.NullableShort), WithoutIsNullAndWithoutCast())); |
| 486 | + |
| 487 | + short value = 3; |
| 488 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort == value), WithoutIsNullAndWithoutCast())); |
| 489 | + await (ExpectAsync(db.NumericEntities.Where(o => value == o.NullableShort), WithoutIsNullAndWithoutCast())); |
| 490 | + |
| 491 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort.Value == value), WithoutIsNullAndWithoutCast())); |
| 492 | + await (ExpectAsync(db.NumericEntities.Where(o => value == o.NullableShort.Value), WithoutIsNullAndWithoutCast())); |
| 493 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short == value), WithoutIsNullAndWithoutCast())); |
| 494 | + await (ExpectAsync(db.NumericEntities.Where(o => value == o.Short), WithoutIsNullAndWithoutCast())); |
| 495 | + |
| 496 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort == 3L), WithoutIsNullAndWithoutCast())); |
| 497 | + await (ExpectAsync(db.NumericEntities.Where(o => 3L == o.NullableShort), WithoutIsNullAndWithoutCast())); |
| 498 | + |
| 499 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort.Value == 3L), WithoutIsNullAndWithoutCast())); |
| 500 | + await (ExpectAsync(db.NumericEntities.Where(o => 3L == o.NullableShort.Value), WithoutIsNullAndWithoutCast())); |
| 501 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short == 3L), WithoutIsNullAndWithoutCast())); |
| 502 | + await (ExpectAsync(db.NumericEntities.Where(o => 3L == o.Short), WithoutIsNullAndWithoutCast())); |
475 | 503 | }
|
476 | 504 |
|
477 | 505 | [Test]
|
@@ -560,6 +588,43 @@ public async Task NullInequalityAsync()
|
560 | 588 |
|
561 | 589 | await (ExpectAsync(session.Query<User>().Where(o => o.CreatedBy.ModifiedBy.Id != 5), Does.Contain("is null").IgnoreCase));
|
562 | 590 | await (ExpectAsync(session.Query<User>().Where(o => 5 != o.CreatedBy.ModifiedBy.Id), Does.Contain("is null").IgnoreCase));
|
| 591 | + |
| 592 | + if (Sfi.Dialect is FirebirdDialect) |
| 593 | + { |
| 594 | + return; |
| 595 | + } |
| 596 | + |
| 597 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort != o.NullableShort), WithIsNullAndWithoutCast())); |
| 598 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short != o.Short), WithoutIsNullAndWithoutCast())); |
| 599 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort != o.Short), WithIsNullAndWithoutCast())); |
| 600 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short != o.NullableShort), WithIsNullAndWithoutCast())); |
| 601 | + |
| 602 | + short value = 3; |
| 603 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort != value), WithIsNullAndWithoutCast())); |
| 604 | + await (ExpectAsync(db.NumericEntities.Where(o => value != o.NullableShort), WithIsNullAndWithoutCast())); |
| 605 | + |
| 606 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort.Value != value), WithIsNullAndWithoutCast())); |
| 607 | + await (ExpectAsync(db.NumericEntities.Where(o => value != o.NullableShort.Value), WithIsNullAndWithoutCast())); |
| 608 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short != value), WithoutIsNullAndWithoutCast())); |
| 609 | + await (ExpectAsync(db.NumericEntities.Where(o => value != o.Short), WithoutIsNullAndWithoutCast())); |
| 610 | + |
| 611 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort != 3L), WithIsNullAndWithoutCast())); |
| 612 | + await (ExpectAsync(db.NumericEntities.Where(o => 3 != o.NullableShort), WithIsNullAndWithoutCast())); |
| 613 | + |
| 614 | + await (ExpectAsync(db.NumericEntities.Where(o => o.NullableShort.Value != 3L), WithIsNullAndWithoutCast())); |
| 615 | + await (ExpectAsync(db.NumericEntities.Where(o => 3L != o.NullableShort.Value), WithIsNullAndWithoutCast())); |
| 616 | + await (ExpectAsync(db.NumericEntities.Where(o => o.Short != 3L), WithoutIsNullAndWithoutCast())); |
| 617 | + await (ExpectAsync(db.NumericEntities.Where(o => 3L != o.Short), WithoutIsNullAndWithoutCast())); |
| 618 | + } |
| 619 | + |
| 620 | + private IResolveConstraint WithIsNullAndWithoutCast() |
| 621 | + { |
| 622 | + return Does.Contain("is null").IgnoreCase.And.Not.Contain("cast").IgnoreCase; |
| 623 | + } |
| 624 | + |
| 625 | + private IResolveConstraint WithoutIsNullAndWithoutCast() |
| 626 | + { |
| 627 | + return Does.Not.Contain("is null").IgnoreCase.And.Not.Contain("cast").IgnoreCase; |
563 | 628 | }
|
564 | 629 |
|
565 | 630 | [Test]
|
|
0 commit comments