Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 4351599

Browse files
committed
Add LeftJoin test
1 parent 0f17bd3 commit 4351599

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/ServiceStack.OrmLite.Tests/LoadReferencesJoinTests.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,5 +474,32 @@ public void Does_populate_custom_mixed_columns()
474474
var countryIds = results.Map(x => x.CountryId);
475475
Assert.That(countryIds, Is.EquivalentTo(new[] { countries[0].Id, countries[1].Id }));
476476
}
477+
478+
[Test]
479+
public void Can_LeftJoin_and_select_empty_relation()
480+
{
481+
AddCustomerWithOrders();
482+
483+
var customer = new Customer
484+
{
485+
Name = "Customer 2",
486+
PrimaryAddress = new CustomerAddress
487+
{
488+
AddressLine1 = "2 America Street",
489+
Country = "USA"
490+
},
491+
};
492+
493+
db.Save(customer, references: true);
494+
495+
var q = db.From<Customer>();
496+
q.LeftJoin<Order>()
497+
.Where<Order>(o => o.Id == null);
498+
499+
var customers = db.Select(q);
500+
501+
Assert.That(customers.Count, Is.EqualTo(1));
502+
Assert.That(customers[0].Name, Is.EqualTo("Customer 2"));
503+
}
477504
}
478505
}

0 commit comments

Comments
 (0)