I cannot figure out how why ActLike is having issues in this particular case. I am testing a controller action that returns a JsonResult and I am attempting to do actionResult.Data.ActLike(typeof(IRow)). the returned object for that call has the outer properties populated just fine, but is having big problems with the 'rows' property. When I try to enumerate it, it says the object does not have GetEnumerator method. What is the proper way to do this? I have tried other iterations where the property is IRow[] which also does not work. Also I am unsure whether my call to ActLike needs the typeof(IRow) parameter,
var zipPreferenceData = credentials.Select(s => new
{
id = s.Id,
cell = new[] { "1", "2", "3", "4", "5" , "6" }
});
var jqGridData = new { page = 1, total = 1, records = credentials.Count, rows = zipPreferenceData };
return new JsonResult { Data = jqGridData, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
public interface IJqGridData
{
int page { get; set; }
int total { get; set; }
int records { get; set; }
IList<IRow> rows { get; set; }
}
public interface IRow
{
long id { get; set; }
string[] cell { get; set; }
}
var data = actionResult.Data.ActLike<IJqGridData>(typeof(IRow));
I cannot figure out how why ActLike is having issues in this particular case. I am testing a controller action that returns a JsonResult and I am attempting to do actionResult.Data.ActLike(typeof(IRow)). the returned object for that call has the outer properties populated just fine, but is having big problems with the 'rows' property. When I try to enumerate it, it says the object does not have GetEnumerator method. What is the proper way to do this? I have tried other iterations where the property is IRow[] which also does not work. Also I am unsure whether my call to ActLike needs the typeof(IRow) parameter,
var data = actionResult.Data.ActLike<IJqGridData>(typeof(IRow));