Interfaces to be part of the C# library

.NET and C# language support on Windows, macOS and Linux
nm17
Phidgeteer!
Posts: 59
Joined: Mon Nov 27, 2017 3:29 am

Interfaces to be part of the C# library

Post by nm17 »

I find myself often writing interfaces and wrappers to match Phidget22 components to aid dependency injection, testing/mocking, etc.

Whilst this is not too difficult to do, it feels this should be part of the library as there would be reassurance that the interfaces match the latest API.

I was wondering if this is something that could be included in the future releases of the c# libraries?
nm17
Phidgeteer!
Posts: 59
Joined: Mon Nov 27, 2017 3:29 am

Re: Interfaces to be part of the C# library

Post by nm17 »

Also, it would be useful to make some classes a little bit friendlier for testing / injection and mocking.

For example VoltageInputVoltageChangeEventArgs is completely read-only, you can't instantiate it with custom Voltage or chage it after instantiation. There isn't really a good case why this should not be possible in my view, it just reduces ability to mock responses.

Code: Select all

public class VoltageInputVoltageChangeEventArgs : EventArgs
{
    //
    // Summary:
    //     Measured voltage
    public readonly double Voltage;

    internal VoltageInputVoltageChangeEventArgs(double voltage)
    {
        Voltage = voltage;
    }
}