<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Unit tests with System-dependent libraries</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/1c6b704829/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/1c6b704829/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/1c6b704829/</id><updated>2022-02-28T16:17:04.606000Z</updated><subtitle>Recent posts to Unit tests with System-dependent libraries</subtitle><entry><title>Unit tests with System-dependent libraries</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/1c6b704829/?limit=50#4ab2" rel="alternate"/><published>2022-02-28T16:17:04.606000Z</published><updated>2022-02-28T16:17:04.606000Z</updated><author><name>ludecus</name><uri>https://forge.codesys.com/u/ludecus/</uri></author><id>https://forge.codesys.comefd58937d2415fd3e1affe1340e554118e2c6b46</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I plan to add Unit tests for our future application with the Test Manager.&lt;br/&gt;
A framework allows me to test the most function blocks really easy.&lt;br/&gt;
Unfortunately, i also have methods which use functions of System-dependent libraries.&lt;/p&gt;
&lt;p&gt;Best example is, that i need to synchronize my system time with a external clock:&lt;br/&gt;
[-img src=Screenshot 2022-02-28 231445.png: missing =-]&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;I started to replaced 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().&lt;/p&gt;
&lt;p&gt;How can i dissolve my dependency? How does CODESYS want me to dissolve this?&lt;/p&gt;
&lt;p&gt;Thanks for any help!!&lt;/p&gt;
&lt;p&gt;PS: The function is only in use, but not under test.&lt;br/&gt;
PPS: I don't want to use pragmas for testing code run.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>