Created
February 24, 2017 15:31
-
-
Save jcolebrand/500c34a848635b924bddabfdf2eea9e4 to your computer and use it in GitHub Desktop.
for talking to Nick Craver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is mockable in your unit tests so you can just assign the func over it | |
public static Func<HttpContextBase> Context = () => new HttpContextWrapper(HttpContext.Current); | |
public void SomeMethod(){ | |
var context = Context(); | |
if (context == null) return; | |
// use context here like you would HttpContext.Current | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment