本文整理汇总了C#中Framework.HttpPost方法的典型用法代码示例。如果您正苦于以下问题:C# Framework.HttpPost方法的具体用法?C# Framework.HttpPost怎么用?C# Framework.HttpPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework
的用法示例。
在下文中一共展示了Framework.HttpPost方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: It_should_be_able_to_read_the_value_out
public void It_should_be_able_to_read_the_value_out()
{
// ARRANGE
var mvc = new Framework();
mvc.HttpContext.AddCookieFixture("firstName", "peter");
// ACT
var result = mvc.HttpPost<SampleController, ContentResult>(c => c.Index(), null);
// ASSERT
Assert.That(result.ActionResult.Content, Is.EqualTo("peter"));
}
示例2: It_should_add_error_to_ModelState
public void It_should_add_error_to_ModelState()
{
// ARRANGE
var mvc = new Framework();
var model = mvc.New<SampleModel>();
model.Name = "ptran"; // greater than 5 characters. should pass validation
// ACT
var result = mvc.HttpPost<SampleController, ViewResult>(c => c.Index(model), model);
// ASSERT
Assert.True(result.ModelStateValidationResult.IsValid);
}
开发者ID:ptran123,项目名称:Conceptual,代码行数:14,代码来源:When_model_implements_IValidatableObject_and_validation_passes.cs
示例3: It_should_add_error_to_ModelState
public void It_should_add_error_to_ModelState()
{
// ARRANGE
var mvc = new Framework();
var model = mvc.New<SampleModel>();
model.Name = "p"; // less then 5 characters. should fail validation
// ACT
var result = mvc.HttpPost<SampleController, ViewResult>(c => c.Index(model), model);
// ASSERT
var hasError = result.ModelStateValidationResult.HasError<SampleModel>(m => m.Name, "Invalid length.");
Assert.True(hasError);
}
开发者ID:ptran123,项目名称:Conceptual,代码行数:15,代码来源:When_model_implements_IValidatableObject_and_validation_fails.cs
示例4: It_should_add_error_to_modelstate
public void It_should_add_error_to_modelstate()
{
// ARRANGE
var mvc = new Framework();
var model = mvc.New<SampleModel>();
model.Name = null;
// ACT
var result = mvc.HttpPost<SampleController, ViewResult>(c => c.Index(model), model);
// ASSERT
var hasError = result.ModelStateValidationResult.HasError<SampleModel>(m => m.Name, "Name is required.");
Assert.True(hasError);
}
开发者ID:ptran123,项目名称:Conceptual,代码行数:15,代码来源:When_model_property_has_RequiredAttribute_and_validation_fails.cs
示例5: It_should_display_an_error_message
public void It_should_display_an_error_message()
{
// ARRANGE
var mvc = new Framework();
var modelView = new CreateModelView();
modelView.CategoryName = null;
// ACT
var result = mvc.HttpPost<CategoryController, ViewResult>(c => c.Create(modelView), modelView);
var model = result.ActionResult.Model as CreateModelView;
// ASSERT
Assert.That(result.ModelStateValidationResult.HasError<CreateModelView>(mv => mv.CategoryName, "A category is required."));
}