Exemple #1
0
        public static ControllerContext GetControllerContext(this LiteController ctrl)
        {
            var ad = new ActionDiscoverer(new ParametersDiscoverer(Fakes.FakeServiceProvider.GetServiceProvider(), new Fakes.FakeDefaultLiteApiOptionsRetriever()));
            var controllerDiscoverer = new ControllerDiscoverer(ad, new LiteApiOptionsAccessor(LiteApiOptions.Default));

            var type    = ctrl.GetType();
            var context = new ControllerContext
            {
                ControllerType = type,
                RouteAndName   = GetControllerName(type, controllerDiscoverer)
            };

            context.Actions = ad.GetActions(context);

            return(context);
        }
Exemple #2
0
        public static ControllerContext GetControllerContext(this LiteController ctrl)
        {
            var ad = new ActionDiscoverer(new ParametersDiscoverer(new Moq.Mock <IServiceProvider>().Object));
            var controllerDiscoverer = new ControllerDiscoverer(ad);

            var type    = ctrl.GetType();
            var context = new ControllerContext
            {
                ControllerType = type,
                RouteAndName   = GetControllerName(type, controllerDiscoverer)
            };

            context.Actions = ad.GetActions(context);

            return(context);
        }