integration testing my moqs are not working
I have made this code. The current account service gets the user account id with logged in/api key ....
But for some reason when i moq it just gives null
In the query handler
the iCurrentAccountservice
the currentaccount service is a Singleton with Di and i'm using clean architecture. I tried alot but I cant get GetCurrentAccountIdAsync to return an id
6 Replies
don't see you registering the mock
Ohhhh i need to register it? Inside the tests ?
hard for DI to find your mock unless you tell it about it
Yeah stupid me thanks
you can see more info about using WebApplicationFactory at https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-9.0
Integration tests in ASP.NET Core
Learn how integration tests ensure that an app's components function correctly at the infrastructure level, including the database, file system, and network.
Thanks you so much!!