C# - how to inject, mock or stub DateTime for unit tests
In this post I will demonstrate how you can stub the DateTime struct in your unit tests. Most commonly the method DateTime.Now or DateTime.UtcNow »
In this post I will demonstrate how you can stub the DateTime struct in your unit tests. Most commonly the method DateTime.Now or DateTime.UtcNow »
In this post I will show how the lock statement in C# works and what you should look out for when using it. It is well »
My previous post on websockets on how to stream messages to a client has become quite popular. I felt that I left this halfway when I »
I have recently had to make an endpoint in asp.net core that receives text/plain content - or raw text as you may call it. »
I found it hard to find a webpage showing a simplistic way to create named value tuples in a list. Most of the examples I could »
This post may seem like sub optimization to some, however high readability of code makes code easier to understand and thereby change. In my opinion, great »
For some reason I can never remember how to make a POST or PUT request with a content-type other than JSON or XML. For JSON and »
In C# it is quite convenient to read all files to an array. You can use the method ReadAllLines() from the File class, all it needs »
Today I found that C# does not have a built in method for trimming strings using another string. The built in method for trimming strings does »
If you are moving from NUnit to xUnit, you will likely encounter the absence of the DoesNotThrow method in xUnit. You are looking for something that »