The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @bagder: If you are a multi billion dollar company and are concerned about log4j, why not just email OSS authors you never paid anything… 3 hours ago
    • RT @hanfrish: Got mugged last night (I’m fine) Guy wanted my wallet but I couldn’t find it quick enough so he took my whole bag I walked pa… 3 hours ago
    • RT @HetVergetenKind: “Er is anderhalf jaar van mijn jeugd afgepakt en ik ben er slechter uitgekomen.” Van gesloten jeugdzorg wordt niemand… 3 hours ago
    • @chrischirp @DrZemouri CC @locuta 3 hours ago
    • RT @chrischirp: BA.2 is growing fast in Denmark and looks to be outcompeting BA.1. In England, there are *very early* signs that BA.2 is… 3 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,572 other followers

Archive for January 26th, 2021

Run your unit tests in parallel with NUnit

Posted by jpluimers on 2021/01/26


The examples in this post are specific for NUnit but, you can apply this pattern for safely running unit tests in parallel to any unit test framework that supports parallel execution.

To safely run tests in parallel, do the following:

  1. Mark your test fixtures with the Parallelizable attribute and set the parallel scope to ParallelScope.All.
  2. Create a private class called TestScope and implement IDisposable.
  3. Put all startup and clean-up logic inside the TestScope constructor and .Dispose() method respectively.
  4. Wrap your test code in a using (var scope = new TestScope) { ... } block

From [WayBack] Run your unit tests in parallel with NUnit, which also covers:

  • Background (on why you might want this)
  • How to safely run tests in parallel
  • Maximizing parallel execution with Visual Studio
  • Maximizing parallel execution with Azure DevOps

Via: [WayBack] Sander Aernouts on Twitter: “Run unit tests in parallel with NUnit without having one test interfere with another test.”


Posted in .NET, Development, Software Development | Leave a Comment »

datetime – Determine Whether Two Date Ranges Overlap – Stack Overflow

Posted by jpluimers on 2021/01/26

[WayBack] datetime – Determine Whether Two Date Ranges Overlap – Stack Overflow answer by Charles Bretana with input from Baodad and tomosius.

TL;DR (proof is in the post)

(StartA <= EndB) and (EndA >= StartB)

Alternative (also from the post):

DateRangesOverlap = max(StartA,StartB) < min(EndA,EndB)

It gets complicated when the date boundaries for A and B can be out of order.

The post also covers that.



Posted in Development, Software Development | Leave a Comment »

Delphi debugging tip: keep an eye on a object field of an object that will go out of scope eventually

Posted by jpluimers on 2021/01/26

Every once in a while you want to have a Delphi Watch of a field inside an object (say an object of type TContext), except that the field has no value yet, but eventually will point to another object (say an object of type TUser).

However, the original object will go out of scope, so you need to employ a few tricks.

First of all, you get the address of that field:

@(Context().FCurrentUser) = $7EF6F624

Then you watch the content of that field:

TUser(PPointer($7EF6F624)^),r = nil

To get to this trick, you have to remember:

  1. The contents of address $7EF6F624 is pointer (at first nil) to a TUser.
  2. You get to the contents of the address $7EF6F624 by using PPointer($7EF6F624)^.
  3. Then you cast it to the object you want with the TUser(...) cast.


Posted in Delphi, Development, Software Development | Leave a Comment »

%d bloggers like this: