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

Commit 7bbc3fd

Browse files
committed
Add test storing/retrieving relaated entities with models that have string ids
1 parent dfb0e08 commit 7bbc3fd

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

lib/ServiceStack.Text.dll

0 Bytes
Binary file not shown.

tests/ServiceStack.Redis.Tests/Generic/RedisTypedClientAppTests.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,40 @@ public void Can_StoreRelatedEntities()
102102
Assert.That(actualAnswers.EquivalentTo(q1Answers));
103103
}
104104

105+
public class Customer
106+
{
107+
public string Id { get; set; }
108+
public string Name { get; set; }
109+
}
110+
111+
public class CustomerAddress
112+
{
113+
public string Id { get; set; }
114+
public string Address { get; set; }
115+
}
116+
117+
[Test]
118+
public void Can_StoreRelatedEntities_with_StringId()
119+
{
120+
var redisCustomers = Redis.As<Customer>();
121+
var customer = new Customer { Id = "CUST-01", Name = "Customer" };
122+
123+
redisCustomers.Store(customer);
124+
125+
var addresses = new[]
126+
{
127+
new CustomerAddress { Id = "ADDR-01", Address = "1 Home Street" },
128+
new CustomerAddress { Id = "ADDR-02", Address = "2 Work Road" },
129+
};
130+
131+
redisCustomers.StoreRelatedEntities(customer.Id, addresses);
132+
133+
var actualAddresses = redisCustomers.GetRelatedEntities<CustomerAddress>(customer.Id);
134+
135+
Assert.That(actualAddresses.Map(x => x.Id),
136+
Is.EquivalentTo(new[] { "ADDR-01", "ADDR-02" }));
137+
}
138+
105139
[Test]
106140
public void Can_GetRelatedEntities_When_Empty()
107141
{

0 commit comments

Comments
 (0)