I am writing a unit test for login process and have used simple membership api.
from web project, login is working fine, but while in unit test. simple membership api is raising exception.
API is throwing error on WebSecurity.Login method.
System.NullReferenceException was caught
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=System.Web
StackTrace:
at System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie, String strCookiePath)
at System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie)
at WebMatrix.WebData.WebSecurity.Login(String userName, String password, Boolean persistCookie)
at [ code ]
InnerException:
WebSecurity.UserExists is working fine.
I think, error is due to 'cookies object is not available in unit test project'