How to simulate network failure for test purposes (in C#)?

前端 未结 11 822
被撕碎了的回忆
被撕碎了的回忆 2020-12-29 04:25

I\'m building what could be called the DAL for a new app. Unfortunately, network connectivity to the database is a real problem.

I\'d like to be able to temporarily

11条回答
  •  长情又很酷
    2020-12-29 05:08

    Just found an alternative that allows to directly close TCP connections:

    http://lamahashim.blogspot.ch/2010/03/disabling-network-using-c.html

    It is based on Windows IP Helper API (uses DllImport): http://msdn.microsoft.com/en-us/library/windows/desktop/aa366073(v=vs.85).aspx

提交回复
热议问题