I'm developing an application that connects to a database, and I'm using DI/IOC. When running the entire application while developing, I naturally want to avoid hitting the DB. Currently, I have something like this in my composition root (using SimpleInjector):
#if DEBUG container.Register<IDbActions, MockDbActions>(); #else container.Register<IDbActions>(() => new RealDbActions(someParameter)); #endif
Is this good practice, or is there a better way to register mocks used for running the entire application during development?
Edit: This is not about unit testing. All classes can be unit tested regardless of what's in the composition root, because the IOC container is (naturally) never used during unit testing.