SimpleTCP icon indicating copy to clipboard operation
SimpleTCP copied to clipboard

Implement interfaces to allow mocking for unit testing

Open Scott-Lyons opened this issue 7 years ago • 2 comments

Would it be possible to implement interfaces of the SimpleTcpClient and Message classes to allow mocking in unit tests.

Scott-Lyons avatar Mar 31 '17 15:03 Scott-Lyons

I suppose we could, what's your unit test scenario where that would be beneficial?

BrandonPotter avatar Mar 31 '17 15:03 BrandonPotter

I'm writing tests to ensure that the SimpleTcpClient is called with the expected ip and port number, and set with the expected properties (Delimiter for example).

I can get so far wrapping the SimpleTcpClient in our own code but this method falls down due to Message having an internal constructor. So the simplest solution would be to provide interfaces.

I'm happy to add them and raise a PR?

Scott-Lyons avatar Apr 03 '17 07:04 Scott-Lyons