I am trying to develop some tests for a Windows 10 UWP application which uses Windows.Devices.Bluetooth.BluetoothLEDevice
. I have a plain class that is part of my application which has a private BluetoothLEDevice
type field.
class MyDevice
{
private Windows.Devices.Bluetooth.BluetoothLEDevice bluetoothLEDevice;
...
// Additional methods which rely on `bluetoothLEDevice`
}
The methods of said class use the events and methods of bluetoothLEDevice
, some are private and others are public. How can I test the public methods of MyDevice
?
I have tried something like this which I think could work, but I can see that it will take hundreds of lines of code and quite a few extra classes because I would need to implement a lot of stuff in FakeBluetoothLEDevice
in orde for it to work properly.
private void ValueChangedEventDataParsingTest()
{
var device = new FakeBluetoothLEDevice();
var myDevice = new MyDevice(device);
device.InvokeValueChanged("this is the value for a fake ValueChangedEvent");
Assert.Equals(probe.SomeProperty, "expected");
}
Are there any frameworks that would help me achieve what I want? Or even a better approach that would save me some pain?
Aucun commentaire:
Enregistrer un commentaire