How do you unit-test a TCP Server? Is it even worth it?

后端 未结 8 1216
一整个雨季
一整个雨季 2021-02-05 10:03

I\'m developing a small TCP server, which will process some TCP packets and behave differently based on the request.

How can I write unit test for this? If it\'s really

8条回答
  •  别那么骄傲
    2021-02-05 10:35

    You might take a look at NMock, a mocking library for .NET. If two parties are involved in a unit-test it's always good to just "mock" one party (the one you are not testing, in that case the Client).

    This will however require some changes to your code, but believe me, it's worth it.

提交回复
热议问题