How to simulate power-related events for testing

I am creating an application that monitors the status of the UPS (uninterruptible power supply, not a freight company) in order to respond to a change in state under power.

I use the PowerStatus class, which gives information to us (% The battery remains, regardless of whether it is running on AC power or on battery, if a USB connection is available)

For our unit tests, I have my own class, which acts as a facade of the PowerStatus class, and I mock this class to insert various events.

I need a way to model the behavior of the UPS in our integration system. Is there a way to emulate a UPS either directly with windows or through WMI?

+4
source share
1 answer

The apcupsd project has a lot of UPS monitoring information. I understand that APC is not the whole market here, but you can use your linear protocol to try to imitate the device. The project is open source and can give you a start:

+1
source

Source: https://habr.com/ru/post/1397488/


All Articles