public void CreateInstance_CreatesFilter()
    {
        // Arrange
        var property            = typeof(StringController).GetProperty(nameof(StringController.StringProp));
        var lifecycleProperties = new[] { new LifecycleProperty(property, "key") };
        var factory             = new ControllerSaveTempDataPropertyFilterFactory(lifecycleProperties);

        // Act
        var filter = factory.CreateInstance(CreateServiceProvider());

        // Assert
        var tempDataFilter = Assert.IsType <ControllerSaveTempDataPropertyFilter>(filter);

        Assert.Same(lifecycleProperties, tempDataFilter.Properties);
    }
    /// <inheritdoc />
    public void OnProvidersExecuting(ApplicationModelProviderContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        foreach (var controllerModel in context.Result.Controllers)
        {
            var modelType = controllerModel.ControllerType.AsType();

            var tempDataProperties = SaveTempDataPropertyFilterBase.GetTempDataProperties(_tempDataSerializer, modelType);
            if (tempDataProperties == null)
            {
                continue;
            }

            var filter = new ControllerSaveTempDataPropertyFilterFactory(tempDataProperties);
            controllerModel.Filters.Add(filter);
        }
    }