Question

I understand how exceptions work and how to catch and handle them in C# but how can I simulate events that may cause an exception to ensure that it is caught correctly? For example, is it possible to run an application in a kind of test bed where it's possible to simulate network problems, database problems, etc? Exceptions by their nature seem hard to reproduce thus making it hard to ensure your code can cope with them.

Although I mainly develop using C#/.NET/Visual Studio, answers or resources relating to other languages could be useful.

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top