I want to write unit test for try catch block(C#).
Public ActionResult Index()
{
try
{
-------------
}
catch(Exception ex)
{
throw;
}
}
As you can see that i am using try-catch block in my index method in controller.And while unit testing this method i want to cover try-catch block also.Where in catch block i am throwing the exception.But i don't have any idea about that.Can anyone suggest me the best way to handle try-catch block ? FYI,i am not specifying any exception type here,it wile fire/throw any exception.
try/catch
away and unit test the unexpected behaviour – Grecism