Skip to content

Commit c164622

Browse files
amend! Update Unit tests for EF Core 10
Update Unit tests for EF Core 10 - Added translations tests for Temporal types - Applied refactorings done since EF Core 9
1 parent c3448f4 commit c164622

File tree

2 files changed

+143
-0
lines changed

2 files changed

+143
-0
lines changed

src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsFbFixture.cs

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
//$Authors = Niek Schoemaker (32094562+niekschoemaker@users.noreply.github.com)
1717

1818
using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.TestUtilities;
19+
using Microsoft.EntityFrameworkCore;
20+
using Microsoft.EntityFrameworkCore.Query.Associations;
1921
using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations;
2022
using Microsoft.EntityFrameworkCore.TestUtilities;
2123

@@ -25,4 +27,100 @@ public class OwnedNavigationsFbFixture : OwnedNavigationsRelationalFixtureBase
2527
{
2628
protected override ITestStoreFactory TestStoreFactory
2729
=> FbTestStoreFactory.Instance;
30+
31+
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
32+
{
33+
base.OnModelCreating(modelBuilder, context);
34+
35+
// Note that this fixture extends OwnedTableSplittingRelationalFixtureBase; it only overrides to
36+
// map the non-collection owned navigations to separate tables (disabling the default table splitting behavior).
37+
modelBuilder.Entity<RootEntity>(b =>
38+
{
39+
b.OwnsOne(
40+
e => e.RequiredAssociate, rrb =>
41+
{
42+
// rrb.Property(x => x.Id).ValueGeneratedNever();
43+
//
44+
// rrb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.Property(x => x.Id).ValueGeneratedNever());
45+
// rrb.Navigation(x => x.RequiredNestedAssociate).IsRequired();
46+
//
47+
// rrb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.Property(x => x.Id).ValueGeneratedNever());
48+
// rrb.Navigation(x => x.RequiredNestedAssociate).IsRequired(false);
49+
50+
rrb.OwnsMany(
51+
r => r.NestedCollection, rcb =>
52+
{
53+
rcb.Property(x => x.Id).ValueGeneratedNever();
54+
rcb.ToTable("RR_NC"); // RequiredRelated_NestedCollection
55+
});
56+
});
57+
b.Navigation(x => x.RequiredAssociate).IsRequired();
58+
59+
b.OwnsOne(
60+
e => e.OptionalAssociate, orb =>
61+
{
62+
// orb.Property(x => x.Id).ValueGeneratedNever();
63+
//
64+
// orb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.Property(x => x.Id).ValueGeneratedNever());
65+
// orb.Navigation(x => x.RequiredNestedAssociate).IsRequired();
66+
//
67+
// orb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.Property(x => x.Id).ValueGeneratedNever());
68+
// orb.Navigation(x => x.RequiredNestedAssociate).IsRequired(false);
69+
70+
orb.OwnsMany(
71+
r => r.NestedCollection, rcb =>
72+
{
73+
rcb.Property(x => x.Id).ValueGeneratedNever();
74+
rcb.ToTable("OR_NC"); // OptionalRelated_NestedCollection
75+
});
76+
});
77+
b.Navigation(x => x.OptionalAssociate).IsRequired(false);
78+
79+
b.OwnsMany(
80+
e => e.AssociateCollection, rcb =>
81+
{
82+
// rcb.Property(x => x.Id).ValueGeneratedNever();
83+
// rcb.ToTable("RelatedCollection");
84+
//
85+
// rcb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.Property(x => x.Id).ValueGeneratedNever());
86+
// rcb.Navigation(x => x.RequiredNestedAssociate).IsRequired();
87+
//
88+
// rcb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.Property(x => x.Id).ValueGeneratedNever());
89+
// rcb.Navigation(x => x.RequiredNestedAssociate).IsRequired(false);
90+
91+
rcb.OwnsMany(
92+
r => r.NestedCollection, rcb =>
93+
{
94+
rcb.Property(x => x.Id).ValueGeneratedNever();
95+
rcb.ToTable("RC_NC"); // RelatedCollection_NestedCollection
96+
});
97+
});
98+
99+
100+
b.OwnsOne(
101+
e => e.RequiredAssociate, rrb =>
102+
{
103+
rrb.ToTable("RequiredRelated");
104+
105+
rrb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.ToTable("RR_RN")); // RequiredRelated_RequiredNested
106+
rrb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.ToTable("RR_ON")); // RequiredRelated_OptionalNested
107+
});
108+
109+
b.OwnsOne(
110+
e => e.OptionalAssociate, rrb =>
111+
{
112+
rrb.ToTable("OptionalRelated");
113+
114+
rrb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.ToTable("OR_RN")); // OptionalRelated_RequiredNested
115+
rrb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.ToTable("OR_ON")); // OptionalRelated_OptionalNested
116+
});
117+
118+
b.OwnsMany(
119+
e => e.AssociateCollection, rcb =>
120+
{
121+
rcb.OwnsOne(r => r.RequiredNestedAssociate, rnb => rnb.ToTable("RC_RN")); // RelatedCollection_RequiredNested
122+
rcb.OwnsOne(r => r.OptionalNestedAssociate, rnb => rnb.ToTable("RC_ON")); // RelatedCollection_OptionalNested
123+
});
124+
});
125+
}
28126
}

src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingFbFixture.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
//$Authors = Niek Schoemaker (32094562+niekschoemaker@users.noreply.github.com)
1717

1818
using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.TestUtilities;
19+
using Microsoft.EntityFrameworkCore;
20+
using Microsoft.EntityFrameworkCore.Query.Associations;
1921
using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting;
2022
using Microsoft.EntityFrameworkCore.TestUtilities;
2123

@@ -25,4 +27,47 @@ public class OwnedTableSplittingFbFixture : OwnedTableSplittingRelationalFixture
2527
{
2628
protected override ITestStoreFactory TestStoreFactory
2729
=> FbTestStoreFactory.Instance;
30+
31+
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
32+
{
33+
base.OnModelCreating(modelBuilder, context);
34+
35+
modelBuilder.Entity<RootEntity>(b =>
36+
{
37+
b.OwnsOne(
38+
e => e.RequiredAssociate, rrb =>
39+
{
40+
rrb.OwnsMany(
41+
r => r.NestedCollection, rcb =>
42+
{
43+
rcb.Property(x => x.Id).ValueGeneratedNever();
44+
rcb.ToTable("RR_NC"); // RequiredRelated_NestedCollection
45+
});
46+
});
47+
b.Navigation(x => x.RequiredAssociate).IsRequired();
48+
49+
b.OwnsOne(
50+
e => e.OptionalAssociate, orb =>
51+
{
52+
orb.OwnsMany(
53+
r => r.NestedCollection, rcb =>
54+
{
55+
rcb.Property(x => x.Id).ValueGeneratedNever();
56+
rcb.ToTable("OR_NC"); // OptionalRelated_NestedCollection
57+
});
58+
});
59+
b.Navigation(x => x.OptionalAssociate).IsRequired(false);
60+
61+
b.OwnsMany(
62+
e => e.AssociateCollection, rcb =>
63+
{
64+
rcb.OwnsMany(
65+
r => r.NestedCollection, rcb =>
66+
{
67+
rcb.Property(x => x.Id).ValueGeneratedNever();
68+
rcb.ToTable("RC_NC"); // RelatedCollection_NestedCollection
69+
});
70+
});
71+
});
72+
}
2873
}

0 commit comments

Comments
 (0)