public void PipelineResultsService_Process() { _resultsService.Process(new DefaultHttpContext()); _flowData.Verify( f => f.Process(), Times.Once, "The process method on flow data should have been called " + "once by the process method."); }
/// <summary> /// Called as part of the MVC pipeline. /// The component serves JavaScript if needed. /// If not, it populates an <see cref="IFlowData"/> object from /// the <see cref="HttpContext"/> and processes it using the /// <see cref="IPipeline"/>. The <see cref="IFlowData"/> instance /// is added to the HttpContext so it can easily be accessed by other /// code. /// </summary> /// <param name="context"> /// The <see cref="HttpContext"/> /// </param> /// <returns> /// The <see cref="Task"/> to be run /// </returns> public async Task Invoke(HttpContext context) { // Populate the request properties and store against the // HttpContext. PipelineResultService.Process(context); // Set HTTP headers in the response based on the results // from the engines in the pipeline. HeaderService.SetHeaders(context); // If 51Degrees JavaScript or JSON is being requested then serve it. // Otherwise continue down the middleware Pipeline. if (JsService.ServeJS(context) == false && JsService.ServeJson(context) == false) { await Next.Invoke(context).ConfigureAwait(false); } }