[SOLVED] Integration Tests | .Net Core WebApi | Fails seeds data when overriding a service in a test
Context: I've coded a custom WebApplicationFactory to setup a web host configuring an in-memory database and seeding data for
User
table.
Expected Test: Ensure global handling exception when an exception is trown in GetById() userService method.
Issue : When I run it, it fails in dbContext.SaveChanges();
logging that it couldn't seed the data, I've debug it and saw that it only happens after overriding the service.


2 Replies
It was solved. My mistake has been putting the stringConnection inside OnConfiguring() method in the DbContext. , I've changed that to utilize dependency injection.
Unknown User•4d ago
Message Not Public
Sign In & Join Server To View