Unit Testing

Test Your .NET HttpClient Based Strongly Typed Clients Like a Boss

Looking at using HttpClient Interception library to setup and create a HttpClient instance to allow for testing strongly typed client classes.

Posted on 29 June 2021

Setting Content for HttpClient Testing with JSON.NET and System.Text.Json

Setting up matches with HttpClient Interception library is one thing, but configuring the data it can return is another. In this post we take a look at the functionality around setting up the content payload to return.

Posted on 14 June 2021

Extending HttpClient Testing With Templating

Continuing the series of HttpClient Interception library by Just Eat by looking at how to use templating to reuse the same bundle definitions across multiple tests.

Posted on 08 June 2021

Defining HttpClient Test Requests by Using a Bundle

Taking a look at how we can easily define multiple request templates when testing with the HttpClient Interception library from Just Eat Tech.

Posted on 18 May 2021

Catching all the Requests while Testing with HttpClient

Making sure tests fail if not all request matches are defined using the HttpClient Interception library from Just Eat Tech.

Posted on 11 May 2021

Beginning to Make Testing with HttpClient Easier

Introduction to the basics of setting up the HttpClient Interception library from Just Eat Tech to allow for testing items which rely on HttpClient.

Posted on 04 May 2021

Easily Create and Manipulate Mock Anonymous Data for Unit Tests

Looking to easily create mock data for unit testing, harnessing the power of AutoFixture, C#9 Records and the Builder Pattern to aid with consistency and maintainability.

Posted on 20 April 2021

Arrange, Act, Assert - Why I Still Comment Unit Tests

Using the Arrange, Act, Assert setup in unit tests, why do I still add the comments? Read on to find out.

Posted on 26 January 2021

Thoughts About Test Driven Development

Thoughts and musings about Test Driven Development, refactoring and how design principles can help with testing

Posted on 14 July 2020

Using Moq Callback to set values to drive tests

How to set a value on an object passed to a mock to drive conditional logic further in the system under test

Posted on 23 June 2020

Refactoring and Learning Challange

Taking up the challenge from a tweet I explain my thought process on improving some code which will hopefully help someone.

Posted on 23 June 2020

How To Assert Collection Count With FluentAssertions

Asserting numbers of items in a list or collection is vital to unit tests, but which to choose?

Posted on 16 June 2020

C#8 Using Declarations With FluentAssertions

Harnessing the power of the C# 8 using declarations to aid with unit test assert clarity

Posted on 05 May 2020

Mocking ILogger with Moq

Looking at how to verify calls to Ilogger based extension methods using Moq.

Posted on 06 February 2020

Unit Testing - Are you asserting too much?

Are you asserting too much in your unit tests? Is this due to potential code smells? Let's discuss.

Posted on 21 May 2019

Mocking the Clock

Reducing the coupling of code dependent on DateTimeOffset

Posted on 15 March 2018