I have a controller method:
public JsonResult CalculateStuff(int coolArg)
{
if(calculatePossible)
return Json(CoolMethod(coolArg));
else return Json(new { Calculated = false });
}
Now I want to check it out.
public void MyTest
{
var controller = GetControllerInstance();
var result = controller.CalculateStuff().Data as dynamic;
Assert.IsTrue(result.Calculated == false);
}
This throws a RuntimeBinderException, which states that Calculated is not defined. Is there any way to achieve this?
UPDATE
Following Jones' advice, I used InternalsVisibleTo to make friends with my test build. Everything is working fine. Thanks, John.
source
share