本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}