Exemplo n.º 1
0
        public override void OnResultExecuted(ResultExecutedContext context)
        {
            context.HttpContext.Response.Headers.Add(
                "OnResultExecuted", new string[] { "ResultExecutedSuccessfully" });

            base.OnResultExecuted(context);
        }
Exemplo n.º 2
0
 public void OnResultExecuted(ResultExecutedContext context)
 {
     var time = _timer.ElapsedMilliseconds;
     context.HttpContext.Response.Headers.Add(
         "ResultElapsedTime",
         new string[] { time.ToString(CultureInfo.InvariantCulture) + " ms" });
 }
Exemplo n.º 3
0
 public override void OnResultExecuted(ResultExecutedContext context)
 {
     if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
     {
         context.HttpContext.Response.Headers.Append("filters",
             "On Action Result Filter - OnResultExecuted");
     }
 }
Exemplo n.º 4
0
        public void SaveTempDataFilter_OnResultExecuted_DoesNotKeepTempData_ForNonIKeepTempDataResult()
        {
            // Arrange
            var tempData = new Mock<ITempDataDictionary>(MockBehavior.Strict);
            var filter = new SaveTempDataFilter(tempData.Object);

            var context = new ResultExecutedContext(
                new ActionContext(),
                new IFilterMetadata[] { },
                new Mock<IActionResult>().Object,
                new object());

            // Act 
            filter.OnResultExecuted(context);

            // Assert - The mock will throw if we do the wrong thing.
        }
Exemplo n.º 5
0
        public void SaveTempDataFilter_OnResultExecuted_KeepsTempData_ForIKeepTempDataResult()
        {
            // Arrange
            var tempData = new Mock<ITempDataDictionary>(MockBehavior.Strict);
            tempData
                .Setup(m => m.Keep())
                .Verifiable();

            var filter = new SaveTempDataFilter(tempData.Object);

            var context = new ResultExecutedContext(
                new ActionContext(),
                new IFilterMetadata[] { },
                new Mock<IKeepTempDataResult>().Object,
                new object());

            // Act
            filter.OnResultExecuted(context);

            // Assert
            tempData.Verify();
        }
 public override void OnResultExecuted(ResultExecutedContext context)
 {
     _logger.LogInformation("OnResultExecuted");
     base.OnResultExecuted(context);
 }
Exemplo n.º 7
0
 public void OnResultExecuted(ResultExecutedContext context)
 {
 }
Exemplo n.º 8
0
 public void OnResultExecuted(ResultExecutedContext context)
 {
     context.HttpContext.Response.Headers.Append("filters", "Controller Override - OnResultExecuted");
 }
 public override void OnResultExecuted(ResultExecutedContext context)
 {
     _logger.LogWarning("ClassFilter OnResultExecuted");
     base.OnResultExecuted(context);
 }