示例#1
0
        public void route_invoke_using_static_method()
        {
            var route   = new Route(typeof(RouteTestingHelper).GetMethod("StaticRoute"));
            var context = TestingMocks.MockContext();

            route.Invoke(context);

            RouteTestingHelper.WhoTriggeredMe().ShouldBe("StaticRoute");
        }
示例#2
0
        public void route_invoke_using_function_wrapped_method()
        {
            Func <IHttpContext, IHttpContext> function = new RouteTestingHelper().RouteTwo;
            var route   = new Route(function);
            var context = TestingMocks.MockContext();

            route.Invoke(context);

            RouteTestingHelper.WhoTriggeredMe().ShouldBe("RouteTwo");
        }
示例#3
0
        public void route_invoke_using_function()
        {
            var triggeredBy = "Anon";
            var context     = TestingMocks.MockContext();
            var route       = new Route(ctx =>
            {
                RouteTestingHelper.WasTriggeredBy(triggeredBy);
                return(ctx);
            });

            route.Invoke(context);

            RouteTestingHelper.WhoTriggeredMe().ShouldBe(triggeredBy);
        }