I'm learning some Web Api basics and I want to return and pass an object by Ok(object)
. Something like this:
[HttpGet]
public IHttpActionResult Get()
{
var someString = "";
return Ok(someString);
}
Now I want to test this method and to assert if the returned string from this Get() method is the same as expected. I Guess will look something like this:
[TestMethod]
public void TestGet()
{
IHttpActionResult result = controller.Get();
Assert.AreEqual("", result.??);
}
I saw this question but the best answer is explaining how to validate the HttpStatusCode
, not the passed object.