public static FakeHttpContext Authenticate(this FakeHttpContext context) { var request = context.Request as FakeHttpRequest; if (request != null) { request.Set(req => req.IsAuthenticated, true); } return(context.Set(new MutableIdentity { IsAuthenticated = true })); }
protected RequestContext NewRequestContext(RouteCollection routes, FakeHttpContext httpContext) { RouteData routeData = routes.GetRouteData(httpContext); return routeData != null ? new RequestContext(httpContext, routeData) : null; }
protected RequestContext NewRequestContext(RouteBase route, FakeHttpContext httpContext) { RouteData routeData = route.GetRouteData(httpContext); return routeData != null ? new RequestContext(httpContext, routeData) : null; }
public static FakeHttpContext Set(this FakeHttpContext context, IIdentity identity, string[] roles) { context.User = new GenericPrincipal(identity, roles); return(context); }
public static FakeHttpContext Set(this FakeHttpContext context, IIdentity identity) { return(context.Set(identity, new string[] { })); }
public static FakeHttpContext Set <T>(this FakeHttpContext context, Expression <Func <FakeHttpContext, T> > getterExpression, T value) { context.Set <FakeHttpContext, T>(getterExpression, value); return(context); }