示例#1
0
 public void handles_one_model_in_argument_properly()
 {
     var sut = new RoutingConventions();
     sut.UseOneModelInHandlerConvention();
     sut.RegisterController<ModelFixtureController>();
     var id = 2;
     sut.HomeIs<ModelFixtureController>(f => f.Get(new ModelHandlerInput(){Page = 67}));
     var routes = sut.BuildRoutes();
     var def = routes.Last();
     def.Url.Should().Be("{*catch}");
     def.Defaults["controller"].Should().Be("ModelFixture");
     def.Defaults["action"].Should().Be("Get");
     def.Defaults["page"].Should().Be(67);                       
 }
 public void get_route_is_generated_from_input_model()
 {
     var sut = new RoutingConventions();
     sut.UseOneModelInHandlerConvention();
     sut.RegisterController<ModelFixtureController>();
     
     var routes = sut.BuildRoutes();
     routes.Count().Should().Be(2);
     var def = routes.First();
     def.Url.Should().Be("ModelFixture/{page}/{text}/{optional}");
     def.Defaults["controller"].Should().Be("ModelFixture");
     def.Defaults["action"].Should().Be("Get");
     def.Defaults.ContainsKey("page").Should().BeFalse();
     def.Defaults["text"].Should().Be(UrlParameter.Optional);
     def.Defaults["optional"].Should().Be(UrlParameter.Optional);
 }
 public void post_route_ignores_input_model()
 {
     var sut = new RoutingConventions();
     sut.UseOneModelInHandlerConvention();
     sut.RegisterController<ModelFixtureController>();
     
     var routes = sut.BuildRoutes();
     routes.Count().Should().Be(2);
     var def = routes.Last();
     def.Url.Should().Be("ModelFixture");
     def.Defaults["controller"].Should().Be("ModelFixture");
     def.Defaults["action"].Should().Be("Post");
     def.Defaults.ContainsKey("page").Should().BeFalse();
     def.Defaults.ContainsKey("text").Should().BeFalse();
     def.Defaults.ContainsKey("optional").Should().BeFalse();
     
 }
示例#4
0
        public void post_route_ignores_input_model()
        {
            var sut = new RoutingConventions();

            sut.UseOneModelInHandlerConvention();
            sut.RegisterController <ModelFixtureController>();

            var routes = sut.BuildRoutes();

            routes.Count().Should().Be(2);
            var def = routes.Last();

            def.Url.Should().Be("ModelFixture");
            def.Defaults["controller"].Should().Be("ModelFixture");
            def.Defaults["action"].Should().Be("Post");
            def.Defaults.ContainsKey("page").Should().BeFalse();
            def.Defaults.ContainsKey("text").Should().BeFalse();
            def.Defaults.ContainsKey("optional").Should().BeFalse();
        }
示例#5
0
        public void get_route_is_generated_from_input_model()
        {
            var sut = new RoutingConventions();

            sut.UseOneModelInHandlerConvention();
            sut.RegisterController <ModelFixtureController>();

            var routes = sut.BuildRoutes();

            routes.Count().Should().Be(2);
            var def = routes.First();

            def.Url.Should().Be("ModelFixture/{page}/{text}/{optional}");
            def.Defaults["controller"].Should().Be("ModelFixture");
            def.Defaults["action"].Should().Be("Get");
            def.Defaults.ContainsKey("page").Should().BeFalse();
            def.Defaults["text"].Should().Be(UrlParameter.Optional);
            def.Defaults["optional"].Should().Be(UrlParameter.Optional);
        }
示例#6
0
        public void handles_one_model_in_argument_properly()
        {
            var sut = new RoutingConventions();

            sut.UseOneModelInHandlerConvention();
            sut.RegisterController <ModelFixtureController>();
            var id = 2;

            sut.HomeIs <ModelFixtureController>(f => f.Get(new ModelHandlerInput()
            {
                Page = 67
            }));
            var routes = sut.BuildRoutes();
            var def    = routes.Last();

            def.Url.Should().Be("{*catch}");
            def.Defaults["controller"].Should().Be("ModelFixture");
            def.Defaults["action"].Should().Be("Get");
            def.Defaults["page"].Should().Be(67);
        }