public void BundlerServer_Responds_To_Requests_For_Bundles() { RegisterBundle(); _Environment.RequestPath = "/bundle.js"; _Pipeline.BuildAndCallMiddleware(_Server.AppFuncBuilder, _Environment.Environment); AssertBundleReturned("hello"); }
public void AccessFilter_Calls_Next_Middleware_When_AccessConfiguration_Allows_Request() { Configure_Acceptable_Request(); _Pipeline.BuildAndCallMiddleware(_Filter.AppFuncBuilder, _Environment.Environment); Assert.IsTrue(_Pipeline.NextMiddlewareCalled); }
public void HtmlManipulator_ManipulateResponseStream_Calls_Any_Registered_Manipulators() { var manipulator = new TextManipulator(); _TextManipulators.Add(manipulator); SetResponseContent(MimeType.Html, "a"); _Pipeline.BuildAndCallMiddleware(_HtmlManipulator.AppFuncBuilder, _Environment.Environment); Assert.AreEqual(1, manipulator.CallCount); Assert.AreSame(_Environment.Environment, manipulator.Environment); Assert.AreEqual("a", manipulator.TextContent.Content); }
public void AudioServer_Responds_To_Request_For_Speech_To_Text() { _Audio.Setup(r => r.SpeechToWavBytes("Hello")).Returns(_SomeBytes); _Environment.SetRequestUrl("/Audio", new [, ] { { "cmd", "say" }, { "line", "Hello" }, }); _Pipeline.BuildAndCallMiddleware(_Server.AppFuncBuilder, _Environment.Environment); AssertAudioReturned(MimeType.WaveAudio, _SomeBytes); }
public void FileSystemServer_Serves_Files_In_SiteRoot() { var content = "Hello World!"; AddSiteRootAndFile(@"c:\web\root", "Hello World.txt", content); ConfigureRequest("/Hello World.txt"); _Pipeline.BuildAndCallMiddleware(_Server.AppFuncBuilder, _Environment.Environment); AssertFileReturned(MimeType.Text, content); }
public void RedirectionFilter_Passes_Request_Through_If_Path_Not_Known() { _Pipeline.BuildAndCallMiddleware(_Filter.AppFuncBuilder, _Environment.Environment); AssertPassedThrough(); }
public void BasicAuthenticationFilter_Calls_Next_Middleware_When_Authentication_Switched_Off() { _Pipeline.BuildAndCallMiddleware(_Filter.AppFuncBuilder, _Environment); AssertRequestAllowed(); }
public void CorsHandler_Preflight_Handles_OPTIONS_Request_From_Valid_Origin() { ConfigureCorsSupport("*"); ConfigurePreflightRequest("http://www.allowed.com"); _Pipeline.BuildAndCallMiddleware(_Handler.AppFuncBuilder, _Environment.Environment); AssertPreflightAccepted("http://www.allowed.com"); }