https://software.codidact.com/categories/38/tags/4422.rssNew Posts Tagged 'mocking' - Software DevelopmentSoftware Development - Codidact2023-09-06T12:47:34Zhttps://software.codidact.com/posts/289584How to implement automatic text-to-link conversion in TypeScript?ShadowsRangerhttps://software.codidact.com/users/580872023-09-05T11:46:21Z2023-09-06T12:47:34Z<p>I'm trying to create an automatic text-to-link conversion feature in a TypeScript application. The desired workflow is:</p>
<ol>
<li>Copy a URL to the clipboard</li>
<li>Select some text</li>...https://software.codidact.com/posts/286031Mocking methods with argumentsklutthttps://software.codidact.com/users/81962022-02-25T11:35:04Z2022-03-07T12:39:21Z<p>Let's say I have this class I want to mock</p>
<pre><code>class A {
public void add(T arg) {
B b = A.getB();
U val = somefunc(arg);
V ret = b.add(val);
}
}...https://software.codidact.com/posts/285541How to mock LazyCache when performing unit testing?Alexeihttps://software.codidact.com/users/531772022-01-11T09:58:07Z2022-01-11T10:01:45Z<p>A few of my services rely on <a href="https://github.com/alastairtree/LazyCache">LazyCache</a> and they use it by injecting <a href="https://github.com/alastairtree/LazyCache/blob/master/LazyCac...https://software.codidact.com/posts/280490Mocking tempnam() with vfsstreamtyteen4a03https://software.codidact.com/users/537392021-01-15T15:08:05Z2021-02-17T16:39:32Z<p>How do I mock <code>tempnam()</code> with vfsStream for code that uses it to create temporary files (for example, in a PHPUnit test)?</p>
<!-- g: js, mdit -->https://software.codidact.com/posts/279555What are the cons of directly mocking Entity Framework DbSets instead of working with an in-memory database when unit testing the application?Alexeihttps://software.codidact.com/users/531772020-11-29T11:50:07Z2020-12-06T17:57:37Z<p>I have recently contributed to a Clean Code project and had a discussion about <a href="https://github.com/jasontaylordev/CleanArchitecture/pull/251">how to implement unit tests</a>.</p>
<p>The...