Gingter Ale

Fluent stories of a software engineer

How to mock HttpClient in your .NET / C# unit tests

2018-07-26

You have a class that depends on HttpClient (or IHttpClientFactory for that matter), and want to unit test that. Since you want a unit test and not an integration test, it should not call a real http endpoint. You decide to mock out your dependency on HttpClient, and soon thereafter you got stuck. After googling ‘How to mock HttpClient’ you landed on this post. So, how would you mock HttpClient for your unit tests?

I give you the short answer right away:

Continue reading

Using versioning in your ASP.NET Core API

2018-06-18
Why should you care about versioning your API? Well, writing a web API with ASP.NET Core is easy. Getting it in production also. But what happens when you have your API live, clients are out there consuming it, and the need arises to change something? This is, when you should have thought about versioning your ASP.NET Core web API. This article shows how to version a web API written using ASP.NET Core. It shows different approaches and explains the differences between them. Continue reading

How to connect your 2fa-enabled iCloud account to Windows 10

2018-02-04
I recently had some trouble adding my iCloud account to the Windows 10 Email & app accounts. The reason for that: I had 2-factor security enabled on my iCloud account. It is not possibly to directly connect an iCloud account with the account password to Windows 10 if 2-factor authentication is enabled. Continue reading

How to run the Babun shell in Cmder

2017-07-29

I want to show you how you can the Babun shell in Cmder.

From my previous blog posts you know I am a fan of Cmder on Windows. It gives me a powerful shell as a replacement of the normal cmd.exe, and it also lets me run Bash and Zsh in the Windows Subsystem for Linux (WSL).

That said, Cmder does not provide a full featured *nix shell, but an extended Windows cmd prompt. And while Bash (or Zsh) on the WSL provide with an full featured Linux shell, it has some drawbacks as it really IS a Linux environment. For example, when you install certain Node packages in your project like PhantomJS, they will bring the Linux version and executables, and you can’t run them from your normal Windows environment.

Babun is a tool, that can bridge this gap.

Continue reading

English keyboard layout hints for German developers

2017-07-28

The German keyboard layout is great. It has everything you need, including all of the umlauts, the ß and also the µ. For programming, however, the German keyboard layout is 💩: The normal braces are on 8 and 9 with shift state, just off by one from the English ones at 9 and 0, but the square and curly braces are available only on Alt-Gr combos left and right from that. Also the forward and backward slashes are Shift and Alt-Gr combos. You can imagine that this slows you down.

So, to be more efficient when writing code, I tried and trained myself to use an English keyboard layout. This is, what I learned.

Continue reading

A little design update for my blog

2017-07-25
You may notice it, this blog has got a small design update. The old theme was fine, but it was very… white with just a little bit of black. I decided to look out for another theme that adds a little bit of color, but still focuses on readability and cleanness. After checking out a lot of themes, testing them and navigating around to get a gasp of the overall look & feel of different themes, I found one that pleases me and hopefully you, too: I decided to go with the official Wordpress Twenty Seventeen theme and just give the color scheme a little personal touch. Continue reading
Older posts