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));
        }
Exemplo n.º 3
0
        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));
        }