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
            }));
        }
예제 #2
0
파일: TestsBase.cs 프로젝트: tkggand/katana
 protected RequestContext NewRequestContext(RouteCollection routes, FakeHttpContext httpContext)
 {
     RouteData routeData = routes.GetRouteData(httpContext);
     return routeData != null ? new RequestContext(httpContext, routeData) : null;
 }
예제 #3
0
파일: TestsBase.cs 프로젝트: tkggand/katana
 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[] { }));
 }
예제 #6
0
 public static FakeHttpContext Set <T>(this FakeHttpContext context, Expression <Func <FakeHttpContext, T> > getterExpression, T value)
 {
     context.Set <FakeHttpContext, T>(getterExpression, value);
     return(context);
 }