Example #1
0
 private static ActionExecutingContext CreateContext()
 {
     return(new ActionExecutingContext(
                new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor()),
                new List <IFilterMetadata>(),
                new Dictionary <string, object>(),
                FilterTestsHelper.CreateMockExportController()));
 }
        private static ActionExecutingContext CreateContextWithParams(Dictionary <string, StringValues> queryParams = null)
        {
            var context = new ActionExecutingContext(
                new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor()),
                new List <IFilterMetadata>(),
                new Dictionary <string, object>(),
                FilterTestsHelper.CreateMockExportController());

            if (queryParams == null)
            {
                queryParams = new Dictionary <string, StringValues>();
                queryParams.Add(KnownQueryParameterNames.DestinationType, SupportedDestinationType);
                queryParams.Add(KnownQueryParameterNames.DestinationConnectionSettings, "connectionString");
            }

            context.HttpContext.Request.Query = new QueryCollection(queryParams);
            return(context);
        }