My project is on MVC...
In WidgetController.cs my method is :
[HttpGet]
public ActionResult GetAllWidgets()
{
try
{
ViewData["WidgetErrMsg"] = "";
using (ISurveyDataRepository<Survey.Lib.Models.Widget> objWidget = new SurveyDataRepository<Survey.Lib.Models.Widget>())
{
return PartialView("GetAllWidgets", objWidget.GetAll().ToList().OrderBy(x => x.RowNumber));
}
}
catch (Exception ex)
{
if (Logger.IsLoggingEnabled())
{
Logger.Write(ex, "GetAllWidgets");
}
ExceptionPolicy.HandleException(ex, "ExceptionLogPolicy");
return View("Error");
}
}
and I want to unit test a method...
So in WidgetControllerTsst.cs what code I should write to unit test this method?