public void BundlerServer_Responds_To_Requests_For_Bundles() { RegisterBundle(); _Environment.RequestPath = "/bundle.js"; _Pipeline.CallMiddleware(_Server.HandleRequest, _Environment.Environment); AssertBundleReturned("hello"); }
public void AccessFilter_Calls_Next_Middleware_When_AccessConfiguration_Allows_Request() { Configure_Acceptable_Request(); _Pipeline.CallMiddleware(_Filter.FilterRequest, _Environment.Environment); Assert.IsTrue(_Pipeline.NextMiddlewareCalled); }
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.CallMiddleware(_Server.HandleRequest, _Environment.Environment); AssertAudioReturned(MimeType.WaveAudio, _SomeBytes); }
public void BasicAuthenticationFilter_Calls_Next_Middleware_When_Authentication_Switched_Off() { _Pipeline.CallMiddleware(_Filter.FilterRequest, _Environment); AssertRequestAllowed(); }
public void CorsHandler_Preflight_Handles_OPTIONS_Request_From_Valid_Origin() { ConfigureCorsSupport("*"); ConfigurePreflightRequest("http://www.allowed.com"); _Pipeline.CallMiddleware(_Handler.HandleRequest, _Environment.Environment); AssertPreflightAccepted("http://www.allowed.com"); }
public void FileSystemServer_Serves_Files_In_SiteRoot() { var content = "Hello World!"; AddSiteRootAndFile(@"c:\web\root", "Hello World.txt", content); ConfigureRequest("/Hello World.txt"); _Pipeline.CallMiddleware(_Server.HandleRequest, _Environment.Environment); AssertFileReturned(MimeType.Text, content); }
public void RedirectionFilter_Passes_Request_Through_If_Path_Not_Known() { _Pipeline.CallMiddleware(_Filter.FilterRequest, _Environment.Environment); AssertPassedThrough(); }
public void ExceptionHandler_Calls_Next_Middleware() { _Pipeline.CallMiddleware(_ExceptionHandler.HandleRequest, _Environment.Environment); Assert.IsTrue(_Pipeline.NextMiddlewareCalled); }
public void ImageServer_Serves_All_Stock_Resource_Images() { var worksheet = new ExcelWorksheetData(TestContext); var requestImageName = worksheet.String("RequestImageName"); var stockImagePropertyName = worksheet.String("StockImage"); var cloneMethod = typeof(Images).GetMethod($"Clone_{stockImagePropertyName}", new Type[0]); var expectedImage = (Bitmap)cloneMethod.Invoke(null, new object[0]); try { _Environment.RequestPath = $"/Images/{requestImageName}.png"; _Pipeline.CallMiddleware(_Server.HandleRequest, _Environment.Environment); using (var stream = new MemoryStream(_Environment.ResponseBodyBytes)) { using (var siteImage = (Bitmap)Bitmap.FromStream(stream)) { AssertImagesAreIdentical(expectedImage, siteImage); } } } finally { expectedImage.Dispose(); } }
public void ResponseStreamWrapper_WrapResponseStream_Always_Calls_Next_Middleware() { InitialiseWrapper(); _Pipeline.CallMiddleware(_Wrapper.WrapResponseStream, _Environment.Environment); Assert.IsTrue(_Pipeline.NextMiddlewareCalled); }