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

后端 未结 8 1214
一整个雨季
一整个雨季 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:52

    I can't give you any specific helpers as your question is fairly open-ended.

    However it sounds as though you'd want to write a mock server/client depending on your needs. It'd be worth looking at Rhino Mocks.

    You might also want to take a look at Oren's NMemCached project which implements a cache server using a custom TCP/IP implementation. That project has some interesting unit/integration tests written using Rhino Mocks.

提交回复
热议问题