I am trying to understand what could be the best design that helps in writing testable code. Let's consider below code ..
void Connection::Connect(const string& url)
{
// My code here that I want to test
ThirdpartClass::Connect(modifiedUrl)
// My code here that I want to test
}
In above example ThirdpartClass::Connect(modifiedUrl) is a third part dependency that actually connects to some third-party server which I want to omit as a part of my unit test code and replace it with mock connect call while executing unit tests. My existing code is tightly bound with third party dependency which makes non testable without involving third party. Is there a better design that makes my code test ready.
Low latency is important so run time polymorphism should be a last resort.
I am planning to use google test framework for writing unit test code.