Søren Kruse | .NET, C# and Azure

  1. Dynamic caching policy with Polly

    Polly is great library for easily configuring different kinds of policies around code execution, be it retry, circuit breaker, caching or lots of other things. It's probably most often used around HTTP requests. If you haven't heard about it you definitely should check it out. App-vNext/PollyPolly is a .NET…

  2. Unit Testing - Part 2: Naming, structure and readability

    This is part 2 of my series on unit testing in .NET (C#) and will be about my conventions regarding naming unit tests, how to structure them and which parts to test. And lastly I will help you increase readability of assertions and potential error messages with the FluentAssertions library.…

  3. Unit Testing - Part 1: Getting started with unit tests in .NET

    I feel like unit testing is very important and very beneficial in a lot of ways. It helps with not breaking existing functionality and thereby also making you more confident in changing code without fear of breaking important stuff. Often it also makes the code less coupled because highly coupled…

  4. Getting NSwag to work behind reverse proxy

    I've been working with Swagger through NSwag a lot recently and also needed to get it to work when hidden behind a reverse proxy - i.e. another service forwarding a request to the service exposing the Swagger UI. Some of the issues I've had along the way: Not working…

  5. NSubstitute - make async method (Task) throw an exception

    The other day I was writing a unit test to verify what was supposed to happen when a Task would throw an exception when awaited. It wasn't as straight forward as I first assumed, but I quickly found this Stack Overflow post that helped me: NSubstitute - mock throwing an…

  6. Handling EPiServer UI descriptors for built-in types like PageData

    Experiencing weird behavior with a UI Descriptor for a built-in type that already has a default descriptor? Here's a way to work around it.…

  7. Sitecore 9 rule-based configuration and numbered roles

    Use numbered role definitions for easier configuration of multiple Sitecore servers with the same role.…

  8. Sitecore release notes made searchable!

    If you're like me you've probably (more than once) had to read/search through several pages of release notes to find out if the issue you are currently having (or a bug you have reported earlier) has been fixed in any of the latest Sitecore releases. Well, at some point…