Beispiel #1
0
        public void SetUp()
        {
            _pipeline = new Mock <IPipeline>();
            _flowData = new Mock <IFlowData>();
            _pipeline.Setup(p => p.CreateFlowData()).Returns(_flowData.Object);
            _evidenceService = new Mock <IWebRequestEvidenceService>();

            _resultsService = new PipelineResultService(
                _evidenceService.Object,
                _pipeline.Object);
        }
Beispiel #2
0
 /// <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);
     }
 }