public void Customize_EmptyList_WhenRouteValueIsMissing([Frozen] IRoutingFeature routing,
                                                                RouteBasedRoleCusomizer customizer,
                                                                string[] allowedRoles, string routeValue)
        {
            customizer.IncludeOriginals = true;
            routing.RouteData.Values.Add("differentName", routeValue);

            List <string>?result = customizer.CustomizeRoles(allowedRoles).ToList();

            Assert.Empty(result);
        }
        public void Customize_ShouldReturnOriginals_WhenFlagNotSet([Frozen] IRoutingFeature routing,
                                                                   RouteBasedRoleCusomizer customizer,
                                                                   string[] allowedRoles, string routeValue)
        {
            customizer.IncludeOriginals = false;
            routing.RouteData.Values.Add(customizer.RouteName, routeValue);
            List <string>?result = customizer.CustomizeRoles(allowedRoles).ToList();

            //Should have only updated roles
            Assert.Equal(allowedRoles.Length, result.Count);

            //No intersection between original roles and customized roles
            Assert.Empty(result.Intersect(allowedRoles));
        }
        public void Customize_ShouldReturnOriginals_WhenFlagSet([Frozen] IRoutingFeature routing,
                                                                RouteBasedRoleCusomizer customizer,
                                                                string[] allowedRoles, string routeValue)
        {
            customizer.IncludeOriginals = true;
            routing.RouteData.Values.Add(customizer.RouteName, routeValue);

            List <string>?result = customizer.CustomizeRoles(allowedRoles).ToList();

            //Should have double the roles
            Assert.Equal(allowedRoles.Length * 2, result.Count);

            //All original roles are in there.
            Assert.Equal(allowedRoles.Length, result.Intersect(allowedRoles).Count());
        }