We’ve just started using specflow to do testing on a large codebase.
Since we’re always adding features we said we’d be doing the tests on the new code and write tests for the old one when it’s time to refactor.
One of our new features implies copying cars from one user’s database to another’s. There’s not much ui for this so we don’t have a way to check everything went ok other than hitting the database.
Is there an alternative to hitting the database when writing tests like this?
If the database access is isolated from the business logic well enough; i.e. behind some sort of repository interface then you cna mock the real repository in your tests and validate that the moked repository is called as would be apropriate for such a copy operation.