Okay I have a rather difficult issue in this case - i have a class which contains a method that requires a class type of a controller. I have no idea how to mock this test so if anyone can help id really appreciate it!
public void Class(Controller controller, Model model)
{
if (model.Address != null && model.Address.Country != null && model.Address.Country.CountryId > 0)
model.Address.Country = _countryService.Find( *expression for id here* );
else
model.Address.Country = null;
controller.ModelState.RemoveRange(controller.ModelState.Where(i => i.Key.StartsWith("Address.Country")).ToList());
controller.ModelState.RemoveRange(controller.ModelState.Where(i => i.Key.Contains(" *Stuff here* ")).ToList());
controller.ModelState.Remove("owner");
}
so my issue here is that the controller class is an abstract class that inherits from multiple other classes:
public abstract class Controller : Class1, Class2, Class3, Class4, Class5, Class6, Class7, Class8, Class9
{
*Lots of un-needed code here*
}
i need to be able to mock the controller in order to be able to get my test to run - otherwise i get a no object set reference on the first Controller.ModelState.
any help would be great!