如何将httpcontext.current添加到specflow

时间:2016-06-20 13:07:23

标签: c# asp.net asp.net-web-api specflow

我有一个方法从控制器的httpcontext中检索身份名称:

public HttpResponseMessage Foo()
{ 
    ...
    var userId = Guid.Parse(HttpContext.Current.User.Identity.Name);
    ...
}

我的specflow测试失败,因为它无法检索Guid,因为没有HttpContext。如何设置它以便我可以为此创建specflow测试?

0 个答案:

没有答案
相关问题