Skip to content

Instantly share code, notes, and snippets.

@juristr
Created February 19, 2013 13:54
Show Gist options
  • Save juristr/4986092 to your computer and use it in GitHub Desktop.
Save juristr/4986092 to your computer and use it in GitHub Desktop.
Mock HttpContext class
IIdentity identity = new GenericIdentity(AccoDAOTest.userADNamePresentInDB);
IPrincipal currentUser = new GenericPrincipal(identity, null);
TextWriter tw = new StringWriter();
HttpWorkerRequest wr = new SimpleWorkerRequest("/webapp", "c:\\inetpub\\wwwroot\\webapp\\", "default.aspx", "", tw);
HttpContext.Current = new HttpContext(wr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment