Мой метод действия заключается в следующем:
Код: Выделить всё
// pseudo code
public async Task Upload()
{
var request = HttpContext.Current.Request;
var file = request.Files[0];//I want to mock this
}
Код: Выделить всё
var mockedRequest = new Mock();//not allowed: Type to mock (HttpRequest) must be an interface, a delegate, or a non-sealed, non-static class.
Как обход, я пытаюсь построить httprequest https://www.splinter.com.au/httpcontext ... tpcontext/
Интересно, как мне протестировать код
Подробнее здесь: https://stackoverflow.com/questions/797 ... postedfile
Мобильная версия