Hi folks,
i've got the following Action Method
I'm trying to moq test. Notice the AcceptVerbs
? I need to make sure i'm testing that.
here's the method.
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create([Bind(Include = "Subject, Content")]Post post,
HttpPostedFileBase imageFileName)
{
...
}
here's the moq code i have...
[TestMethod]
public void Create_Action_snip_sniop_When_Http_Post_Is_Succesful()
{
// Arrange.
var mock = new Mock<ControllerContext>();
mock.SetupGet(m => m.HttpContext.Request.HttpMethod).Returns("POST");
// Snip some other arrangements.
var controller = PostController;
controller.ControllerContext = mock.Object;
// Act.
var viewResult = controller.Create(post, image.Object) as ViewResult;
// Assert.
Assert.IsNotNull(viewResult);
// TODO: Test that the request was an Http-Post.
what do i need to do to verify the request was a post?