많은 예제를 살펴 보았습니다. 그러나이 경우 아래에서이 메서드를 리팩토링 할 때마다 새로운 단위 세트를 사용하여 테스트 할 수 있습니다. moq와 mstest를 사용하고 있는데 appsettings가 HttpContext와 함께 봉인된다는 것을 알고 있습니다. 어떤 도움이나 생각 (건설적인)도 크게 감사하겠습니다.refactor를보고 단위 테스트 및 moq에 대한 Appsettings 및 HttpContext
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);
}
}
3 가지 솔루션으로 응답 해 주셔서 감사합니다. –