从单元测试和依赖注入的角度来看,涉及到帮助方法时,通常采用什么标准?
下面是我的示例情况:
public class GoodiesController : Controller
{
private IMyContext _context;
public GoodiesController(IMyContext context)
{
_context = context
}
public async Task<IAction> GetThoseGoodies()
{
if(YouLikeThemThisWay(Request.Path))
{
var result = await _context.GoGetThemThisWay()
} else { }
}
我的问题是,如果我可能会有一些类似
YouLikeThemThisWay
的方法,我是更适合将YouLikeThemThisWay(string path)
作为某个类的静态帮助器还是私有实例方法呢?