用户信息如何从UnitTest传递给控制器? [英] How could User info be passed from UnitTest to controller?
本文介绍了用户信息如何从UnitTest传递给控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[TestMethod]
public void UnitTestMethod1()
{
Test1Controller controller = new Test1Controller();
//This call throws NullReferenceException "Object reference not set to an instance of an object."
WebSecurity.Login("User1", "password1");
controller.TestMethod();
}
在上面的代码中如何使WebSecurity.Login调用工作?
谢谢。
In code above how to make WebSecurity.Login call work?
Thanks.
推荐答案
这篇关于用户信息如何从UnitTest传递给控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文