I'm trying to make extensive tests for my new project but I have a problem.
Basically I want to test MyClass. MyClass makes use of several other class which I don't need/want to do their job for the purpose of the test. So I created mocks (I use gtest and gmock for testing)
But MyClass instantiate everything it needs in it's constructor and release it in the destructor. That's RAII I think.
So I thought, I should create some kind of factory, which creates everything and gives it to MyClass's constructor. That factory could have it's fake for testing purposes. But's thats no longer RAII right?
Then what's the good solution here?