Unit Tests


NUnit historically has been the most popular .NET testing framework.  IN this section i'll cover everything you need to get up and writing some basic tests.

Ms Test Vs NUnit Vs xUnit... Which Ones The Best? YOU DECIDE!

On any .NET project you should be writing unit tests.  I won't go into the benefits of unit testing here, but when you're new to unit testing, after understanding the importance of testing and deciding to get stuck in, the next thing you need to deci[...]

Quick And Dirty Guide To Unit Testing With NUnit

Today's guide is going to be very quick and simple.  The actual writing of the unit test is usually pretty easy, the harder part is knowing how to write testable code, setting up/mocking the set dependencies required for your tests and also wrapping [...]

How To Pass Parameters Into Your NUnit Tests

When a lot of people start unit testing, they seem to think that because the code isn't 'production' code that the unit test code doesn't really matter that much and that they can hack together something quick and dirty and it doesn't matter. Genera[...]


If you want to drastically cut down on the amount of boring set-up code you need to write in order to test your website, then I receommend checkign out Autofixture.

How You Can Use AutoFixture and AutoData To Drastically Improve Your Unit Tests - Part 1

If you have ever worked on a large project using TDD, or, you've worked on a big project where the team was aiming for a very high test coverage, then you'll understand the time and effort it take to write your tests set-up code.  In some instances, [...]

How You Can Use AutoFixture To Eliminate Boilerplate Continuous Integration tests - Part 2

Writing boring boiler plate test sucks.  When it comes to writing monotonous tests, I sometimes feel like I'd rather shoot myself in the foot just so I can get out of it.  This hatred of doing dull repetitive tasks generally means I'm constantly Goog[...]

How To Get AutoFixtures AutoData Property To Work With NUNit

I've previously written about my love for Autofixture and how I'd recommend that you start using it on your project to make you drastically reduce the amount of unit testing set-up code you'll need to write.  I tend to use NUnit on projects (with a l[...]

Fluent Assertions

Fluent Assertions is another great tool I use when unit testing.  Fluent Assertions is a simple lightweight extension that will make it eassier to read and write your tests.

What Is Fluent Assertions and Should I Be Using It?

Releasing a project without bugs is an essential part of every project.  One of the quickest and easiest tools to help you achieve that goal are unit tests.  Regardless of how high, or low your test coverage is, you should be writing unit tests. One [...]

Selenium & C#

Selenium is a popular open-source automation tool that you can use to test how your webpages look and behave.  You can use Selenium with C# unit tests to ensure that you don't break pages, your forms work as expeceted etc.. This section will cover a basic introduction to get you up and running with Selenium on your project.

How To Write Frontend Unit Tests with C# and Selenium

I think a lot of developers have heard of Selenium, however, from my experience very few teams get around to using Selenium on their projects.  Like Unit Testing in general, I think most people have 'frontend' testing on their 'we SHOULD do this list[...]

How To SetUp BrowserStackLocal on Your PC And Your Build Server

If you want a semi-easy way to be able to run some front-end unit tests within your C# project, then this article is for you.  I've talked previously about setting up Selenium with C# and Browserstack automate here.  I've recently started using Brows[...]

Misc Testing Tips

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[...]

Homepage Build Csharp Websites Unit Tests
Back to top