public void no_correction_with_no_querystring() { var request = new StandInCurrentHttpRequest(); var mimeType = new CurrentMimeType("text/json", theOriginalMimetype); new ConnegSettings().InterpretQuerystring(mimeType, request); mimeType.AcceptTypes.Single().ShouldEqual(theOriginalMimetype); }
public void correct_to_xml() { var request = new StandInCurrentHttpRequest(); request.QueryString["Format"] = "XML"; var mimeType = new CurrentMimeType("text/json", theOriginalMimetype); new ConnegSettings().InterpretQuerystring(mimeType, request); mimeType.AcceptTypes.Single().ShouldEqual(MimeType.Xml.Value); }
public void SetUp() { theHttpRequest = new StandInCurrentHttpRequest(); UrlContext.Stub("http://server"); theUrlResolver = new ChainUrlResolver(theHttpRequest); theGraph = BehaviorGraph.BuildFrom(registry => { registry.Actions.IncludeType <ChainUrlResolverEndpoint>(); }); theSimpleChain = theGraph.BehaviorFor <ChainUrlResolverEndpoint>(x => x.get_index()); theChainWithRouteParams = theGraph.BehaviorFor(typeof(ChainUrlParams)); }
public void use_a_custom_querystring_parameter() { var request = new StandInCurrentHttpRequest(); request.QueryString["Format"] = "Text"; var settings = new ConnegSettings(); settings.QuerystringParameters.Add(new ConnegQuerystring("Format", "Text", MimeType.Text)); var mimeType = new CurrentMimeType("text/json", theOriginalMimetype); settings.InterpretQuerystring(mimeType, request); mimeType.AcceptTypes.Single().ShouldEqual(MimeType.Text.Value); }
public void can_inject_arguments_into_the_behavior_factory() { var standInCurrentHttpRequest = new StandInCurrentHttpRequest(); var inMemoryFubuRequest = new InMemoryFubuRequest(); var arguments = new ServiceArguments() .With <ICurrentHttpRequest>(standInCurrentHttpRequest) .With <IFubuRequest>(inMemoryFubuRequest); var behavior = ContainerFacilitySource .BuildBehavior(arguments, ObjectDef.ForType <GuyWhoNeedsRequest>(), x => { }) .As <GuyWhoNeedsRequest>(); behavior.Http.ShouldBeTheSameAs(standInCurrentHttpRequest); behavior.Request.ShouldBeTheSameAs(inMemoryFubuRequest); }
public void SetUp() { theRequest = new StandInCurrentHttpRequest(); }