<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Howto on Hermit Blog</title><link>https://hermit.no/categories/howto/</link><description>Recent content in Howto on Hermit Blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 22 Aug 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://hermit.no/categories/howto/index.xml" rel="self" type="application/rss+xml"/><item><title/><link>https://hermit.no/how-to/how-to-convert-api-to-aspire/</link><pubDate>Fri, 22 Aug 2025 00:00:00 +0000</pubDate><guid>https://hermit.no/how-to/how-to-convert-api-to-aspire/</guid><description>&lt;h1 id="how-to-convert-an-existing-api-to-aspire"&gt;How to convert an existing Api to Aspire&lt;/h1&gt;&#10;&lt;p&gt;For documentation on this see &lt;a href="https://learn.microsoft.com/en-us/dotnet/aspire/get-started/add-aspire-existing-app?tabs=windows&amp;amp;pivots=vscode"&gt;Add Aspire to Existing-App&lt;/a&gt;&lt;/p&gt;</description></item><item><title/><link>https://hermit.no/how-to/how-to-set-up-aspire/</link><pubDate>Fri, 22 Aug 2025 00:00:00 +0000</pubDate><guid>https://hermit.no/how-to/how-to-set-up-aspire/</guid><description>&lt;h1 id="how-to-set-up-aspire"&gt;How to set up Aspire&lt;/h1&gt;&#10;&lt;p&gt;A step-by-step procedure to set up Aspire&lt;/p&gt;</description></item><item><title>How to extend the NUnit constraints</title><link>https://hermit.no/nunit/how-to-extend-the-nunit-constraints/</link><pubDate>Sun, 29 Dec 2024 00:00:00 +0000</pubDate><guid>https://hermit.no/nunit/how-to-extend-the-nunit-constraints/</guid><description>&lt;p&gt;&lt;a href="http://nunit.org/"&gt;NUnit&lt;/a&gt; has a very rich and readable constraint set. Normally you don’t need to do anything. But, there are some cases where it would be nice to be able to tweak these constraints. You can always wrap them and extend them that way, but then you lose all the other good stuff, like chaining. What is not so well known is that you can extend the existing constraints, they are **designed** to be extendable! In this post I will show how you can do that easily.&lt;/p&gt;</description></item><item><title>How to convert NUnit Assert.AreEqual to fluent Assert.That syntax easily</title><link>https://hermit.no/nunit/how-to-convert-nunit-assert.areequal-to-fluent-assert.that-syntax-easily/</link><pubDate>Sat, 03 Nov 2018 22:44:25 +0100</pubDate><guid>https://hermit.no/nunit/how-to-convert-nunit-assert.areequal-to-fluent-assert.that-syntax-easily/</guid><description>&lt;p&gt;Once upon a time it was declared that an Assert statement should have constraints given as AreEqual and AreNotEqual.&#10;Further it was declared that it should be written in the opposite way of how a developer will think, that is with the expected value first and the actual value last.&#10;Why this was made so, is still unknown.&lt;/p&gt;&#10;&lt;p&gt;But we end up with tons of code like:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AreEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Zulu&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zulu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AreEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Z - Zulu&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zulu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AreEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;FlagType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zulu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sort&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AreEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zulu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AspectRatio&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And it is not uncommon to see the two parameters swapped, making the displayed results harder to interpret.&lt;/p&gt;&#10;&lt;p&gt;If we write this with the fluent syntax:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;That&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;zulu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Is&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EqualTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Zulu&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the &lt;em&gt;new&lt;/em&gt; fluent notation in NUnit (new and new&amp;hellip;. it has been around for a very long time now, at least since NUnit 2.4, and that is pretty far back in time).&lt;/p&gt;&#10;&lt;p&gt;But - converting from one to another is not fun. Doing this manually is a very boring task.&lt;/p&gt;&#10;&lt;p&gt;Enter the &lt;a href="https://github.com/nunit/nunit.analyzers"&gt;NUnit.Analyzers&lt;/a&gt;, a new set of Roslyn based analyzers with refactoring.&lt;/p&gt;</description></item></channel></rss>