Get instance of class with private constructor for test

34 Views Asked by At

during testing I need an instance of the following class public class WmiServiceTarget : SensorTarget<WmiServiceTarget> that has the following constructor:

private WmiServiceTarget(string raw): base(raw)
    {
        DisplayName = components[1];
        Description = components[2];
        Status = components[3].XmlToEnum<WmiServiceStatus>();
    }

In the SensorTarget the constructor:

protected SensorTarget(string raw)
    {
        if (raw == null)
        {
            throw new ArgumentNullException("raw");
        }

        this.raw = raw;
        components = raw.Split(new char[1]
        {
            '|'
        });
        Name = components[0];
    }

Is there a way of getting an instance of WmiServiceTarget.

All classes can be found in https://github.com/lordmilko/PrtgAPI

0

There are 0 best solutions below