BrandonPotter / SimpleTCP

Straightforward .NET library to handle the repetitive tasks of spinning up and working with TCP sockets (client and server).
Apache License 2.0
365 stars 108 forks source link

Implement interfaces to allow mocking for unit testing #10

Open Scott-Lyons opened 7 years ago

Scott-Lyons commented 7 years ago

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

BrandonPotter commented 7 years ago

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

Scott-Lyons commented 7 years ago

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?