I have looked at a lot of examples, but in this case I wish to get a fresh set of eyes on refactoring this method below so that I can unit test it. I'm using mstest with moq and I know that the appsettings is a problem, along with the HttpContext being sealed.... Any help or thoughts (constructive) is greatly appreciated.
public void DoClaimSearch(SearchClaimInfo clmRequest)
{
var result = claimManager.ClaimSearch(clmRequest);
if (result.RespMsg.TotalRowCount > Convert.ToInt32(ConfigurationManager.AppSettings.Get("TotalRowCount_Max_ClaimSearch")))
{
string ResKey = HttpContext.GetGlobalResourceObject("Global", "info_toomanyrecordsmatch.Text").ToString();
ResKey = ResKey.Replace("{0}", result.RespMsg.TotalRowCount.ToString());
View.AddNotification(WidgetNotificationType.Error,ResKey);
}
else
{
View.SetWidgetResponseData(result.RespMsg.SearchResults);
}
}