本文整理汇总了C#中FubuMVC.Core.Registration.Routes.RouteParameters类的典型用法代码示例。如果您正苦于以下问题:C# RouteParameters类的具体用法?C# RouteParameters怎么用?C# RouteParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RouteParameters类属于FubuMVC.Core.Registration.Routes命名空间,在下文中一共展示了RouteParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: is_satisfied_positive
public void is_satisfied_positive()
{
var parameters = new RouteParameters<FakeInput>();
parameters[x => x.Code] = "something";
_parameter.IsSatisfied(parameters).ShouldBeTrue();
}
示例2: to_query_string_from_route_parameter_with_a_value
public void to_query_string_from_route_parameter_with_a_value()
{
var parameters = new RouteParameters<FakeInput>();
parameters[x => x.Code] = "something";
_parameter.ToQueryString(parameters).ShouldEqual("Code=something");
}
示例3: resolve_a_url_with_route_params_explicitly_filled
public void resolve_a_url_with_route_params_explicitly_filled()
{
var values = new RouteParameters();
values["Name"] = "Joel";
theUrlResolver.UrlFor(theChainWithRouteParams, values).ShouldBe("/Joel");
}
示例4: is_satisfied_with_a_default_value_but_nothing_in_the_parameters
public void is_satisfied_with_a_default_value_but_nothing_in_the_parameters()
{
var parameters = new RouteParameters<FakeInput>();
_parameter.DefaultValue = "something";
_parameter.IsSatisfied(parameters).ShouldBeTrue();
}
示例5: create_link_by_identifier
public void create_link_by_identifier()
{
theLinks.ToSubject(x => x.Id);
var parameters = new RouteParameters<Site>();
parameters[x => x.Id] = theSubject.Id.ToString();
theLinks.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
.Single().Url.ShouldEqual(theUrls.UrlFor(typeof(Site), parameters));
}
示例6: create_a_link_by_using_route_parameters
public void create_a_link_by_using_route_parameters()
{
theLinks.ToInput<SiteAction>(x => x.Name);
var parameters = new RouteParameters<SiteAction>();
parameters["Name"] = theSubject.Name;
theLinks.As<ILinkSource<Site>>().LinksFor(theTarget, theUrls)
.Single().Url.ShouldEqual(theUrls.UrlFor(parameters));
}
示例7: the_route_has_route_input
public void the_route_has_route_input()
{
var input = theChain.Route.Input.ShouldBeOfType<RouteInput<MethodInput>>();
input.ShouldNotBeNull();
var parameters = new RouteParameters();
parameters["Start"] = "2";
parameters["End"] = "5";
input.CreateUrlFromParameters(parameters).ShouldEqual("cases/from/2/to/5");
}
示例8: should_constrain_routes_by_MethodToUrlBuilder_if_they_match
public void should_constrain_routes_by_MethodToUrlBuilder_if_they_match()
{
var input = _policy.Build(HandlersObjectMother.HandlerWithRouteInput()).Input;
var parameters = new RouteParameters();
parameters["Year"] = "2011";
parameters["Month"] = "7";
parameters["Title"] = "hello-world";
input
.CreateUrlFromParameters(parameters)
.ShouldEqual("posts/2011/7/hello-world");
}
示例9: create_url_with_parameters
public void create_url_with_parameters()
{
var url = new RouteInput<SampleViewModel>("test/edit/{InPath}");
url.AddRouteInput(x => x.InPath);
var parameters = new RouteParameters<SampleViewModel>();
parameters[x => x.InPath] = "5";
url.CreateUrlFromParameters(parameters).ShouldEqual("test/edit/5");
}
示例10: create_url_with_null_input_model_and_no_default_value_specified_for_optional_input_with_parameters
public void create_url_with_null_input_model_and_no_default_value_specified_for_optional_input_with_parameters()
{
var url = new RouteInput<SampleViewModelWithInputs>("test/edit/{OptionalInput}");
url.AddRouteInput(x => x.OptionalInput);
var parameters = new RouteParameters<SampleViewModelWithInputs>();
url
.CreateUrlFromParameters(parameters)
.ShouldEndWith("test/edit/default");
}
示例11: create_url_with_multiple_variables_in_path_by_parameters
public void create_url_with_multiple_variables_in_path_by_parameters()
{
var url = new RouteInput<SampleViewModel>("test/edit/{InPath}/{AlsoInPath}");
url.AddRouteInput(x => x.InPath);
url.AddRouteInput(x => x.AlsoInPath);
var parameters = new RouteParameters<SampleViewModel>();
parameters[x => x.InPath] = "5";
parameters[x => x.AlsoInPath] = "some text";
url.CreateUrlFromParameters(parameters).ShouldEqual("test/edit/5/some%20text");
}
示例12: create_url_with_input_model_and_default_value_for_required_input_by_parameters
public void create_url_with_input_model_and_default_value_for_required_input_by_parameters()
{
var url = new RouteInput<SampleViewModelWithInputs>("test/edit/{RequiredInput}");
url.AddRouteInput(x => x.RequiredInput);
var parameters = new RouteParameters<SampleViewModelWithInputs>();
parameters[x => x.RequiredInput] = "a";
url
.CreateUrlFromParameters(parameters)
.ShouldEndWith("test/edit/a");
}
示例13: can_substitute_greedy_parameters
public void can_substitute_greedy_parameters()
{
var parameters = new RouteParameters<FakeInput>();
parameters[x => x.Code] = "computers/laptop/i7/dell&ibm";
_parameter.Substitute(parameters, "product/category/{*Code}").ShouldEqual("product/category/computers/laptop/i7/dell%26ibm");
}
示例14: IsSatisfied
public bool IsSatisfied(RouteParameters routeParameters)
{
return routeParameters.Has(_accessor.Name) || DefaultValue != null;
}
示例15: to_query_string_from_route_parameter_with_an_encoded_value
public void to_query_string_from_route_parameter_with_an_encoded_value()
{
var parameters = new RouteParameters<FakeInput>();
parameters[x => x.Code] = "abc/def&ghi=jkl";
_parameter.ToQueryString(parameters).ShouldEqual("Code=abc%2Fdef%26ghi%3Djkl");
}