ValidateAllowedDlsSubApplication_does_not_set_not_found_result_if_no_application_list_set()
        {
            // Given
            GivenUserIsTryingToAccess(DlsSubApplication.LearningPortal);

            var attribute =
                new ValidateAllowedDlsSubApplication(featureManager);

            // When
            attribute.OnActionExecuting(context);

            // Then
            context.Result.Should().BeNull();
        }
        ValidateAllowedDlsSubApplication_sets_not_found_result_if_application_is_null()
        {
            // Given
            GivenUserIsTryingToAccess(null);

            var attribute =
                new ValidateAllowedDlsSubApplication(
                    featureManager,
                    new[] { nameof(DlsSubApplication.LearningPortal) }
                    );

            // When
            attribute.OnActionExecuting(context);

            // Then
            context.Result.Should().BeNotFoundResult();
        }
        ValidateAllowedDlsSubApplication_does_not_set_result_if_no_application_parameter_found()
        {
            // Given
            GivenUserIsTryingToAccess(DlsSubApplication.TrackingSystem);
            context.ActionDescriptor.Parameters = new ParameterDescriptor[] { };

            var attribute =
                new ValidateAllowedDlsSubApplication(
                    featureManager,
                    new[] { nameof(DlsSubApplication.LearningPortal) }
                    );

            // When
            attribute.OnActionExecuting(context);

            // Then
            context.Result.Should().BeNull();
        }
        ValidateAllowedDlsSubApplication_sets_not_found_result_if_relevant_feature_flag_off(
            string application,
            string featureFlag
            )
        {
            // Given
            GivenUserIsTryingToAccess(Enumeration.FromName <DlsSubApplication>(application));

            A.CallTo(() => featureManager.IsEnabledAsync(featureFlag))
            .Returns(false);

            var attribute =
                new ValidateAllowedDlsSubApplication(featureManager);

            // When
            attribute.OnActionExecuting(context);

            // Then
            context.Result.Should().BeNotFoundResult();
        }