I plan to add Unit tests for our future application with the Test Manager.
A framework allows me to test the most function blocks really easy.
Unfortunately, i also have methods which use functions of System-dependent libraries.
Best example is, that i need to synchronize my system time with a external clock:
For the synchronization i currently use the SysTimeRtcSet function of the eponymous library. Each run of a test case for the synchronization method will call this function and manipulate my system time.
I started to replace this function by using the DateTimeProvider of the Util library, which at least implements an iDateTimeProvider interface. But the DateTimeProvider only allows me to GetDateTime().
How can i dissolve my dependency? How does CODESYS want me to dissolve this?
Thanks for any help!!
PS: The function is only in use, but not under test.
PPS: I don't want to use pragmas for testing code run.
I plan to add Unit tests for our future application with the Test Manager.
A framework allows me to test the most function blocks really easy.
Unfortunately, i also have methods which use functions of System-dependent libraries.
Best example is, that i need to synchronize my system time with a external clock:
For the synchronization i currently use the SysTimeRtcSet function of the eponymous library. Each run of a test case for the synchronization method will call this function and manipulate my system time.
I started to replace this function by using the DateTimeProvider of the Util library, which at least implements an iDateTimeProvider interface. But the DateTimeProvider only allows me to GetDateTime().
How can i dissolve my dependency? How does CODESYS want me to dissolve this?
Thanks for any help!!
PS: The function is only in use, but not under test.
PPS: I don't want to use pragmas for testing code run.
Last edit: ludecus 2022-02-28