This project is read-only.


Testing of controllers are easy thanks to the ControllerTester class.

void MyTest()
    // Create a controller.
    MyController controller = new MyController();

    // build up a form that is used by the controller.
    HttpForm form = new HttpForm();
    form.Add("user[firstName]", "Jonas");

    // Invoke the request
    ControllerTester tester = new ControllerTester();
    IHttpResponse response;
    string text = tester.Post(controller, "/user/create/", form, out response, null);

    // validate response back from controller.
    Assert.Equal("User 'Jonas' has been created.", text);

Last edited Sep 1, 2008 at 4:38 PM by jgauffin, version 1


No comments yet.