I have a controller method which returns JsonResult (Namespace: System.Web.Http.Results
)
public async Task<IHttpActionResult> GetConfig(string section, string group, string name)
{
var configurations = await _repository.GetConfig(section, group, name);
return Json(new { configurations = configurations.ToList() }, SerializerSettings);
}
I am trying to Unit Test this method.Here is what I have so far
[Test]
public async void Should_Return_List_Of_Configs_Json()
{
var section= "ABC";
var group= "some group";
var name= "XYZ";
var response = await controller.GetConfig(section, group, name);
Assert.IsNotNull(response);
}
I am not able to read Json string from the above method as I can't see a response.Content property.The call to the method is returning mocked response.
Can someone help me out with this?