本文整理汇总了C#中RouteValueDictionary.WithRouteValue方法的典型用法代码示例。如果您正苦于以下问题:C# RouteValueDictionary.WithRouteValue方法的具体用法?C# RouteValueDictionary.WithRouteValue怎么用?C# RouteValueDictionary.WithRouteValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteValueDictionary
的用法示例。
在下文中一共展示了RouteValueDictionary.WithRouteValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WithRouteValue_ThrowIfValueTypeMismatch
public void WithRouteValue_ThrowIfValueTypeMismatch()
{
var dict = new RouteValueDictionary();
dict.Add("Existing", 1);
Assert.Throws<ValueTypeMismatchException>(() => dict.WithRouteValue("Existing", "1"));
}
示例2: WithRouteValue_ThrowsWhenDictHasIncorrectValue
public void WithRouteValue_ThrowsWhenDictHasIncorrectValue()
{
var dict = new RouteValueDictionary();
dict.Add("Existing", "Correct");
Assert.Throws<InvalidRouteValueException>(() => dict.WithRouteValue("Existing", "Incorrect"));
}
示例3: WithRouteValue_ThrowsWhenDictDoesntHaveValue
public void WithRouteValue_ThrowsWhenDictDoesntHaveValue()
{
var dict = new RouteValueDictionary();
dict.Add("Existing", "NotImportant");
Assert.Throws<MissingRouteValueException>(() => dict.WithRouteValue("NotExisting"));
}
示例4: WithRouteValue_CanUseIntType
public void WithRouteValue_CanUseIntType()
{
var dict = new RouteValueDictionary();
dict.Add("Existing", 10);
dict.WithRouteValue("Existing", 10);
Assert.Pass();
}
示例5: WithRouteValue_DoesntThrowIfValueIsCorrect
public void WithRouteValue_DoesntThrowIfValueIsCorrect()
{
var dict = new RouteValueDictionary();
dict.Add("Existing", "Correct");
dict.WithRouteValue("Existing", "Correct");
Assert.Pass();
}
示例6: WithRouteValue_ThrowsWhenDictIsEmpty
public void WithRouteValue_ThrowsWhenDictIsEmpty()
{
var dict = new RouteValueDictionary();
Assert.Throws<MissingRouteValueException>(() => dict.WithRouteValue("NotImportant"));
}