Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UTs for Command Classes #40

Open
13 tasks
dfederm opened this issue Jun 30, 2022 · 0 comments
Open
13 tasks

Add UTs for Command Classes #40

dfederm opened this issue Jun 30, 2022 · 0 comments
Labels
infrastructure Related to infrastructure and development

Comments

@dfederm
Copy link
Owner

dfederm commented Jun 30, 2022

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
@dfederm dfederm added the infrastructure Related to infrastructure and development label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Related to infrastructure and development
Projects
None yet
Development

No branches or pull requests

1 participant