I am trying to add some unit / integration tests to my database service, I can't figure out how to mock the database
I can mock the IScope but the database comes back as null.
Some help would be greatly appreciated!
n
Nik
12/10/2024, 10:29 AM
The short answer is "don't" - you can probably use the Umbraco.Cms.Test package to get access to all the core services being Moq'd the way HQ does it so you don't have to try and moq it yourself.
I'm trying to test against a custom table from a custom database service
b
Brendan
12/10/2024, 10:34 AM
What are you using/how are you connecting to the custom table?
a
AaronSadlerUK
12/10/2024, 10:34 AM
Using Npoco via IScope
b
Brendan
12/10/2024, 10:35 AM
I've hit the actual database, integration test style before but scoped each test in the setup teardown so you can reset the state, if that makes sense?
Would that work?