I want to write tests for the code below. For this I want to inject in a mocked HttpContext using RhinoMocks.
HttpContext is sealed though.
How should I handle this?
Thanks
public PaxiumPrincipal CreatePrincipalFromCookie(HttpContext context)
{
HttpCookie authCookie = context.Request.Cookies[FormsAuthentication.FormsCookieName];
if (authCookie == null)
{
return null;
};
var authTicket = FormsAuthentication.Decrypt(authCookie.Value);
if (authTicket == null)
{
return null;
};
var userPrincipal = new PaxiumPrincipal(new GenericIdentity(authTicket.Name), null);
return userPrincipal;
}