Finding typos with ReSharper Command Line Tools, ReSpeller and Cake
2017-10-27
I tend to do a lot of typos when I write a code and I mean a lot.
This is quite annoying for me so I decided to somehow automate the process of finding the spelling errors during the build.
My first thought was to use some kind of Roslyn analyzer, however, I failed to find any working one.
This is why I decided to give a try to ReSharper Command Line Tools (also known as CLIT) combined with ReSpeller plugin.
For those who don’t know, ReSharper Command Line Tools is set of tools which allow you to use ReSharper inspections without Visual Studio
931 words
|
5 minutes
ASP.NET Core 1.x - curios case of missing IOptions<T> array item
2017-10-17
Last week while I was working on one of the features for my current project, I noticed quite surprising behavior of IOptions<T> object.
Long story short, for some reasons there were missing array elements in my parsed application settings class.
429 words
|
2 minutes
.NET Core - calculating code coverage with OpenCover (on Windows)
2017-10-12
I’ve been struggling for some time to make OpenCover work with .NET Core projects, so I’ve decided to document a working example.
This is basically an aggregation of hints and answers I found on the Web (especially in here)
326 words
|
2 minutes
ASP.NET Core – request serialization issues after migration from classic WebApi
2017-08-21
We’ve been migrating a classic WebApi application into the ASP.NET Core API for quite a while now, and last week we decided to deploy it on the test environment and try to run a website against it.
We were pretty confident about the quality of a migration because all of the integration tests from old API were green when running against a new one.
We were expecting maybe some business logic bugs but from our perspective, the infrastructure part was good to go.
Unfortunately, when the QA's run the selenium test suite they quickly found a major issue in our codebase.
They basically were getting HTTP 500 errors indicating a NullReferenceException.
That was pretty surprising to us and after a bit of a digging we found following lines in the logs
407 words
|
2 minutes
NLog.Web.AspNetCore - make sure you add error message for logging exception
2017-07-09
I’ve been using NLog for quite some time already, and it was a natural choice to use it in the ASP.NET Core projects as well.
I’ve configured the logger using this tutorial and everything seemed to be working fine.
Unfortunately, after some time we’ve noticed that for some reasons some of the errors are not logged.
We’ve taken a deeper look at our code base and we’ve found couple logs being written as follows
251 words
|
1 minute
XUnit - MemberDataAttribute and generic type inheritance
2017-06-19
When I was writing Cake.Intellisense I was playing a lot with Roslyn syntax rewriters.
The one thing which was pretty important for me at this time was a reliable set of tests which can quickly show if rewritten code is valid C# code and if it matches my expectations.
As I don’t like to repeat my code I wanted to have a base test class which can be provided with different test cases from inherited classes.
The initial implementation looked as follows
770 words
|
4 minutes
NSubstitute - returning value from IEnumerable
2017-06-12
I’ve been using NSubstitute combined with automocks for quite some time already, but recently I’ve encountered quite interesting situation.
Let’s assume that we have the following class we need to write tests for
352 words
|
2 minutes
Dotnet CLI - running tests from multiple assemblies
2017-06-07
When you start looking for information how to run unit tests for .NET Core based projects in the command line, you will most probably stumble upon dotnet CLI and its dotnet test command.
The command works really great when you have just one test project in your solution, however, it doesn’t allow you to run tests from multiple projects at once.
Of course, you can write little PowerShell which will run the command in the loop e.g.
249 words
|
1 minute