简体   繁体   中英

How to test a parallel port C# application?

I am implementing a simple C# application that controls some leds (on/off) through the parallel port. My problem now is that I would like to test the application and monitor the behavior of the signals that I send out.

Question:

Is it possible to have like a virtual parallel port address on my windows PC and monitor this port ? Note that I don't have a LPT port in my laptop, this application will be executed on another PC.

Encapsulate your basic parallel port operations in a class that implements an interface. Then use constructor injection to provide an implementation of your parallel port interface to any class that needs to use a parallel port. That way, you can mock out a fake parallel port implementation to provide whatever sort of data you want to use for the purposes of your unit tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM