-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
infrastructureRelated to infrastructure and developmentRelated to infrastructure and development
Description
For each command of each command class, write UTs.
For "get"/"report" command pairs, something like:
MockDriver driver = new();
Node node = new Node();
FooCommandClass commandClass = new(node, driver, ...);
ReadOnlySpan<byte> responseData = new[] { ... };
dirver.MockResponse(FooCommand.Get, responseData);
var state = await commandClass.GetAsync();
// Verify the report command's parsing
Assert.AreEqual(someValue, commandClass.State.Something);
// Verify Get command's binary format
Assert.AreEqual(1, driver.SentCommands.Count);
CollectionAssert.AreEqual(new[] { ... }, driver.SentCommands[0]);"Set" commands would be similar, but without the response part.
Likely interfaces would need to be introduced, for example IDriver so that a MockDriver could be produced for the UT.
CCs needing UTs:
- Basic
- Battery
- BinarySensor
- BinarySwitch
- ColorSwitch
- ManufacturerSpecific
- MultilevelSensor
- MultilevelSwitch
- Notification
- Powerlevel
- Version
- WakeUp
- ZWavePlusInfo
Metadata
Metadata
Assignees
Labels
infrastructureRelated to infrastructure and developmentRelated to infrastructure and development