Misc Unit Testing Snippets

How To Unit Test That A Log4Net Error Has Been Made

When you test your code you want to test two things.  That the successful route and the unsuccessful route through your method works as expected.  One way of doing this is to write a unit test that checks that Log4Net has written a message.  Luckily,[...]

How To Unit Test Entity Framework

If you want to learn how to easily write unit tests for entity framework, read on.  All your entity framework code will talk to a database, which under normal test conditions will fail.  Instead, to make your tests easy to write we want to hi-jack yo[...]

Unit Testing Hangfire

A common requirement is the need to have some code to run on a regular basis.  Instead of re-inventing the wheel, we can use third-party packages to do this for us. In this section, you'll find a number of tutorials around .NET scheduling packages

Setting Up Structure Map With Hangfire

In this tutorial, you will learn how to use dependency injection with Hangfire. Having high test coverage within your code should be your aim. This article assumes that you have the following packages installed within your project: Hangfire Hang[...]

How To Unit Test Your Hangfire Tasks

On most tutorials you come across that involve Hangfire, most will use a static Hangfire API.  Most tutorials also add tasks into Hangfire as static classes.  If you love TDD and you want to make your codebase as testable as possible, then read on. [...]

Homepage C Sharp Bootcamp TDD Misc Unit Testing Snippets
Back to top