'Navigation property on entity is lost when calling endpoint in integration test (same dbContext)
I struggle to figure out, what is going wrong with my integration test and why my navigation property is lost, when I get entity from dbContext inside my API. I'm using an InMemoryDatabase to temp seed and store data.
After seeding data, which works, I call my endpoint built upon WebApplicationFactory (InMemoryApi) Both my Integration tests and InMemoryApi, uses the same InMemoryDatabase.This is the Actor entity with navigation property Tenant, filled out
When getting dbContext inside InMemoryApi, the navigation property "Tenant" is now null on the Actor (wasn't before).
But if I inspect it afterwards, I can clearly see it does exist in dbContext.
Now the funky part is. If I then go back and inspect my Actor again after inspecting the Tenant, the tenant is now visible on the Actor. How is this even possible and what may go wrong?`This is only an issue with the Integration test. The application is working fine otherwise.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|




