2
我有两个单元测试和Web项目项目。使用Cookie进行MVC单元测试
AuthenticationController controller = new AuthenticationController();
ViewResult result = controller.LogOut() as ViewResult;
Assert.IsNotNull(result);
在项目中,我会传递http cookie和授权请求。
当我运行LogOut测试时,它会在获取cookie时失败。有没有办法通过创建一个假的cookie或任何其他方式来克服这个问题?
在此先感谢。
看一看这个答案:http://stackoverflow.com/questions/18098585/moq-mocking-mvc-controllers-response-cookies-clear/18101855#18101855 –
显示LogOut'的'实施 – Nkosi