本文整理汇总了C#中System.Web.Mvc.ViewResult.AssertModelStateError方法的典型用法代码示例。如果您正苦于以下问题:C# ViewResult.AssertModelStateError方法的具体用法?C# ViewResult.AssertModelStateError怎么用?C# ViewResult.AssertModelStateError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.ViewResult
的用法示例。
在下文中一共展示了ViewResult.AssertModelStateError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_blow_up_if_model_state_does_not_have_key_for_exception
public void Should_blow_up_if_model_state_does_not_have_key_for_exception()
{
var viewDataDictionary = new ViewDataDictionary();
var result = new ViewResult {
ViewData = viewDataDictionary
};
result.AssertModelStateError<Exception>("foo", 0);
}
示例2: Should_blow_up_if_model_state_does_not_have_exception_at_specified_index
public void Should_blow_up_if_model_state_does_not_have_exception_at_specified_index()
{
var viewDataDictionary = new ViewDataDictionary();
viewDataDictionary.ModelState.AddModelError("foo", new Exception());
var result = new ViewResult {
ViewData = viewDataDictionary
};
result.AssertModelStateError<Exception>("foo", 1);
}
示例3: Should_blow_up_if_model_state_does_not_have_error_at_specified_index
public void Should_blow_up_if_model_state_does_not_have_error_at_specified_index()
{
var viewDataDictionary = new ViewDataDictionary();
viewDataDictionary.ModelState.AddModelError("foo", "error message");
var result = new ViewResult {
ViewData = viewDataDictionary
};
result.AssertModelStateError("foo", 1, "foo");
}
示例4: Should_blow_up_if_model_state_exceptions_do_not_match
public void Should_blow_up_if_model_state_exceptions_do_not_match()
{
var viewDataDictionary = new ViewDataDictionary();
viewDataDictionary.ModelState.AddModelError("foo", new ArgumentException());
var result = new ViewResult {
ViewData = viewDataDictionary
};
result.AssertModelStateError<ArgumentNullException>("foo", 0);
}
示例5: Should_blow_up_if_model_state_error_message_do_not_match
public void Should_blow_up_if_model_state_error_message_do_not_match()
{
var viewDataDictionary = new ViewDataDictionary();
viewDataDictionary.ModelState.AddModelError("foo", "error message");
var result = new ViewResult {
ViewData = viewDataDictionary
};
result.AssertModelStateError("foo", 0, "not the correct message");
}
示例6: Should_verify_model_state_exception
public void Should_verify_model_state_exception()
{
var viewDataDictionary = new ViewDataDictionary();
viewDataDictionary.ModelState.AddModelError("foo", new ArgumentException());
var result = new ViewResult {
ViewData = viewDataDictionary
};
result.AssertModelStateError<ArgumentException>("foo", 0);
}
示例7: Should_verify_model_error_message
public void Should_verify_model_error_message()
{
var viewDataDictionary = new ViewDataDictionary();
viewDataDictionary.ModelState.AddModelError("foo", "error message");
var result = new ViewResult {
ViewData = viewDataDictionary
};
result.AssertModelStateError("foo", 0, "error message");
}