Unit testing
#
Unit testing in NetDaemonNetDaemon provides fakes and mocks to unit test your automations. This is currently in pre-release so expect the API to be finilized until stable Unit test samples are provided as a part of the official app development template on github
#
NetDaemon nuget package for testsAll the funktionality is provided by the JoySoftware.NetDaemon.Fakes
component.
#
Baseclass for testsThe test class should inherit the RxAppMock
class.
#
Basics of writing testsThe fakes are running the NetDaemon core logic in the background as async messages. This is why the tests needs to be in async
to ensure proper operation.
As an example we want to test the automation below:
Then we make the following test method The daemon fake needs to be initialized and ran in specific order for the unit test to work like in the example below: