craftedsoftware
asked on
Override class method in unit test to return expected results
In a unit test, I would like to be able to change the default behaviour of a method for a class instance in order to validate that my class handles the edge case properly.
For example,
In my test case when I make a call as follows
System.Data.SqlClient.SqlC onnection conn = new System.Data.SqlClient.SqlC onnection ();
For this particular test case I want it to always return an Exception with particular details.
This way I can always ensure that the code for database connection failures work.
Any thoughts on how I might solve this problem.
For example,
In my test case when I make a call as follows
System.Data.SqlClient.SqlC
For this particular test case I want it to always return an Exception with particular details.
This way I can always ensure that the code for database connection failures work.
Any thoughts on how I might solve this problem.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.