当前位置: 首页>>代码示例>>C#>>正文


C# RouteCollection.GetFirstUntranslatedRoute方法代码示例

本文整理汇总了C#中RouteCollection.GetFirstUntranslatedRoute方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.GetFirstUntranslatedRoute方法的具体用法?C# RouteCollection.GetFirstUntranslatedRoute怎么用?C# RouteCollection.GetFirstUntranslatedRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteCollection的用法示例。


在下文中一共展示了RouteCollection.GetFirstUntranslatedRoute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFirstUntranslatedRoute_NoRouteExists_ReturnsNull

        public void GetFirstUntranslatedRoute_NoRouteExists_ReturnsNull()
        {
            // Arrange
            RouteCollection routeCollection = new RouteCollection();

            // Act
            Route route = routeCollection.GetFirstUntranslatedRoute("de", "Home", "Index", string.Empty);

            // Assert
            Assert.IsNull(route);
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:11,代码来源:RouteCollectionExtensionsTests.cs

示例2: GetFirstUntranslatedRoute_OneRouteExistsFirstHasTranslation_ReturnsNull

        public void GetFirstUntranslatedRoute_OneRouteExistsFirstHasTranslation_ReturnsNull()
        {
            // Arrange
            TranslationRoute route1 =
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler()).ToTranslationRoute();

            route1.TranslatedRoutes["de"] =
                new Route("Start", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler()).ToTranslationRoute();

            RouteCollection routeCollection = new RouteCollection() { route1 };

            // Act
            Route route = routeCollection.GetFirstUntranslatedRoute("de", "Home", "Index", string.Empty);

            // Assert
            Assert.IsNull(route);
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:19,代码来源:RouteCollectionExtensionsTests.cs

示例3: GetFirstUntranslatedRoute_NoRouteExistsForNamespace_ReturnsNull

        public void GetFirstUntranslatedRoute_NoRouteExistsForNamespace_ReturnsNull()
        {
            // Arrange
            RouteCollection routeCollection = new RouteCollection
            {
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary() { { "Namespaces", new[] { "Namespace1" } } },
                    new MvcRouteHandler()),
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary() { { "Namespaces", new[] { "Namespace2" } } },
                    new MvcRouteHandler())
            };

            // Act
            Route route = routeCollection.GetFirstUntranslatedRoute("de", "Home", "Index", "Namespace3");

            // Assert
            Assert.IsNull(route);
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:19,代码来源:RouteCollectionExtensionsTests.cs

示例4: GetFirstUntranslatedRoute_ThreeRoutesExistsFirstHasTranslationSecondIsTranslation_ReturnsThird

        public void GetFirstUntranslatedRoute_ThreeRoutesExistsFirstHasTranslationSecondIsTranslation_ReturnsThird()
        {
            // Arrange
            TranslationRoute route1 =
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler()).ToTranslationRoute();

            route1.TranslatedRoutes["de"] =
                new Route("Start", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler()).ToTranslationRoute();

            route1.TranslatedRoutes["de"].TranslationRouteRoot = route1;

            RouteCollection routeCollection = new RouteCollection
            {
                route1,
                route1.TranslatedRoutes["de"],
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler())
            };

            // Act
            Route route = routeCollection.GetFirstUntranslatedRoute("de", "Home", "Index", string.Empty);

            // Assert
            Assert.AreSame(routeCollection[2], route);
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:27,代码来源:RouteCollectionExtensionsTests.cs

示例5: GetFirstUntranslatedRoute_TwoTranslationRouteExists_ReturnsFirst

        public void GetFirstUntranslatedRoute_TwoTranslationRouteExists_ReturnsFirst()
        {
            // Arrange
            RouteCollection routeCollection = new RouteCollection
            {
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler()).ToTranslationRoute(),
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler()).ToTranslationRoute()
            };

            // Act
            Route route = routeCollection.GetFirstUntranslatedRoute("de", "Home", "Index", string.Empty);

            // Assert
            Assert.AreSame(routeCollection[0], route);
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:17,代码来源:RouteCollectionExtensionsTests.cs

示例6: GetFirstUntranslatedRoute_TwoRoutesWithTargetActionMethodExists_ReturnsCorrectRoute

        public void GetFirstUntranslatedRoute_TwoRoutesWithTargetActionMethodExists_ReturnsCorrectRoute()
        {
            // Arrange
            RouteCollection routeCollection = new RouteCollection
            {
                new Route("Home", new RouteValueDictionary() { { "controller", "MissingAttribute" }, { "action", "Index" } },
                    new RouteValueDictionary(),
                    new RouteValueDictionary() { { "TargetActionMethod", typeof(MissingAttributeController).GetMethod("Index") } },
                    new MvcRouteHandler()),
                new Route("Home", new RouteValueDictionary() { { "controller", "MissingAttribute" }, { "action", "Index" } },
                    new RouteValueDictionary(),
                    new RouteValueDictionary() { { "TargetActionMethod", typeof(Core.MissingAttributeController).GetMethod("Index") } },
                    new MvcRouteHandler())
            };

            // Act
            Route route = routeCollection.GetFirstUntranslatedRoute("de", "MissingAttribute", "Index",
                "RouteLocalizationMVC.Tests.Core");

            // Assert
            Assert.AreSame(routeCollection[1], route);
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:22,代码来源:RouteCollectionExtensionsTests.cs

示例7: GetFirstUntranslatedRoute_TwoRoutesWithoutNamespacesExists_ReturnsFirst

        public void GetFirstUntranslatedRoute_TwoRoutesWithoutNamespacesExists_ReturnsFirst()
        {
            // Arrange
            RouteCollection routeCollection = new RouteCollection
            {
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler()),
                new Route("Home", new RouteValueDictionary() { { "controller", "Home" }, { "action", "Index" } },
                    new RouteValueDictionary(), new RouteValueDictionary(), new MvcRouteHandler())
            };

            // Act
            Route route = routeCollection.GetFirstUntranslatedRoute("de", "Home", "Index", "Namespace1");

            // Assert
            Assert.AreSame(routeCollection[0], route);
        }
开发者ID:CiprianPorumbescu,项目名称:RouteLocalizationMVC,代码行数:17,代码来源:RouteCollectionExtensionsTests.cs


注:本文中的RouteCollection.GetFirstUntranslatedRoute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。