mardi 9 août 2016

Testing Nancy Module with Get["/{value}"]

I am having trouble testing a route in nancy.

this.Get["/search/{guid}"] = request => LookupEntity(request.guid);

I am trying to simulate this in a unit testing, but I keep getting an InternalServerError

public void FormSearchModule_GetSearchRoute_StatusReturnOK()
{
    // Arrange
    const HttpStatusCode expected = HttpStatusCode.OK;

    // Act
    var result = this.browser.Get("/search/25892e17-80f6-415f-9c65-7395632f0223", with =>
    {        
        with.HttpRequest();
    });

    // Assert
    Assert.AreEqual(expected, result.StatusCode);
}

I am new to Nancy, and I can't seem to find any examples of testing this on the Nancy documentation or anywhere else.

Thanks for the help.

Aucun commentaire:

Enregistrer un commentaire