chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I need to ExpectAndThrow a SqlException, but because SqlException cannot be inherited and does not expose any constructors, I have some problems. Anyone run into this?
asked by csustek (4k points)

1 Answer

0 votes
Hi
You can use the MockManager.MockObject method
like this:
MockObject mo = MockManager.MockObject(typeof(SqlException));
mock.ExpectAndThrow("MyMethod", (SqlException)mo.Object);


Hope it helps :D
answered by ohad (35.4k points)
...