First, you should use sealed classes and singleton everywhere - none of these wrapper classes with virtual methods that can be mocked or anything else. Then, and this is important, you should use Reponse.Write instead of returning. It also helps to serialize the contents of all form parameters, encrypt them and store them in hidden input on the page - then always check the new parameters for the old ones to see what things have changed. Using this method, you can create things called “events” - they look like button presses and are selected in Windows Forms. This is much easier to understand and simulate in your unit tests.
source
share