public IEnumerable <AttributeRoute> BuildAllRoutes()
        {
            var routeReflector = new RouteReflector(_configuration);
            var routeSpecs     = routeReflector.GenerateRouteSpecifications();

            return(routeSpecs.Select(Build));
        }
        public IEnumerable<AttributeRoute> BuildAllRoutes()
        {
            var routeReflector = new RouteReflector(_configuration);
            var routeSpecs = routeReflector.GenerateRouteSpecifications();

            return routeSpecs.Select(Build);
        }
        public void Returns_specified_url_for_area_url_when_both_subdomain_is_specified_and_area_url_is_specified()
        {
            var configuration = new AttributeRoutingConfiguration();
            configuration.AddRoutesFromController<SubdomainWithAreaUrlController>();

            var reflector = new RouteReflector(configuration);
            var specs = reflector.GenerateRouteSpecifications().ToList();

            Assert.That(specs.Count, Is.EqualTo(1));
            Assert.That(specs.Single().Subdomain, Is.EqualTo("private"));
            Assert.That(specs.Single().AreaUrl, Is.EqualTo("admin"));
        }
Exemple #4
0
        public IEnumerable<AttributeRoute> BuildAllRoutes()
        {
            var routeReflector = new RouteReflector(_configuration);
            var routeSpecs = routeReflector.GenerateRouteSpecifications().ToList();
            var mappedSubdomains = routeSpecs.Where(s => s.Subdomain.HasValue()).Select(s => s.Subdomain).Distinct().ToList();

            foreach (var routeSpec in routeSpecs)
            {
                foreach (var route in Build(routeSpec))
                {
                    route.MappedSubdomains = mappedSubdomains;
                    yield return route;
                }
            }
        }
        public void Returns_subdomain_specified_for_area_via_configuration_object()
        {
            var configuration = new AttributeRoutingConfiguration();
            configuration.AddRoutesFromController<SubdomainController>();
            configuration.MapArea("Users").ToSubdomain("override");

            var reflector = new RouteReflector(configuration);
            var specs = reflector.GenerateRouteSpecifications().ToList();

            var spec = specs.SingleOrDefault();
            Assert.That(spec, Is.Not.Null);
            Assert.That(spec.Subdomain, Is.EqualTo("override"));
            Assert.That(spec.AreaName, Is.EqualTo("Users"));
            Assert.That(spec.AreaUrl, Is.EqualTo(null));
        }
        public void Returns_null_area_url_when_controller_configured_with_subdomain_only_via_configuration_object()
        {
            var configuration = new AttributeRoutingConfiguration();
            configuration.AddRoutesFromController<SubdomainControllerWithoutSubdomainInAttribute>();
            configuration.MapArea("NoSubdomain").ToSubdomain("subdomain");

            var reflector = new RouteReflector(configuration);
            var specs = reflector.GenerateRouteSpecifications().ToList();

            var spec = specs.SingleOrDefault();
            Assert.That(spec, Is.Not.Null);
            Assert.That(spec.Subdomain, Is.EqualTo("subdomain"));
            Assert.That(spec.AreaName, Is.EqualTo("NoSubdomain"));
            Assert.That(spec.AreaUrl, Is.EqualTo(null));
        }
Exemple #7
0
        public IEnumerable <AttributeRoute> BuildAllRoutes()
        {
            var routeReflector   = new RouteReflector(_configuration);
            var routeSpecs       = routeReflector.GenerateRouteSpecifications().ToList();
            var mappedSubdomains = routeSpecs.Where(s => s.Subdomain.HasValue()).Select(s => s.Subdomain).Distinct().ToList();

            foreach (var routeSpec in routeSpecs)
            {
                foreach (var route in Build(routeSpec))
                {
                    route.MappedSubdomains = mappedSubdomains;
                    yield return(route);
                }
            }
        }