Test query issue in StoreControllerTest
anpete opened this issue · 1 comments
anpete commented
Queries that used to return an entity with InMemory store now return null.
Repro
Test:
The query:
MusicStore/samples/MusicStore/Controllers/StoreController.cs
Lines 59 to 63 in dc60a2e
album = await DbContext.Albums
.Where(a => a.AlbumId == id)
.Include(a => a.Artist)
.Include(a => a.Genre)
.FirstOrDefaultAsync();
When the .Include extensions are removed from the query, it returns an entity as expected.
Reason: Artist should never be null here - It is configured in the model as Required by convention because Album.ArtistId is not nullable. Either configure the relationship to be Optional, or ensure that the test albums have artists assigned.