The hierarchy is like this:
IMonitoringBase <- (abstract) MonitoringBase <- (abstract) OperationalDataObject <- MonitoringAlert <- ConnectorMonitoringAlert
The only constructor is in OperationalDataObject and it's protected.
I only need to create an instance for test purposes so that I can arrange what would be returned.
When I try to use reflection like this:
var ctor = typeof(ConnectorMonitoringAlert).GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(c => !c.GetParameters().Any());
var instance = (ConnectorMonitoringAlert)ctor.Invoke(new object[0]);
ctor returns null
if I try to instantiate it normally it says that the ConnectorMonitoringAlert doesn't contain a constructor which takes 0 arguments. But, It doesn't seem to have any other constructors either
Aucun commentaire:
Enregistrer un commentaire