Home About

All posts tagged with "Unit tests"

A unit test is a test of single unit of code, this could be a method or function. Sometimes this test is done in isolation using predefined test doubles.

Page 1 of 1

C# - How to mock or stub a class without an interface

Sometimes you come across a class that you need to stub or mock but it does not have an interface. The easiest way is of course »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Test doubles, Testing, Unit tests, C# 15 May 2022

xUnit - How to assert that a call throws an exception

A year ago I made a post on the absence of the DoesNotThrow assertion in xUnit. In this post I show how you can assert if »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on XUnit, Testing, Unit tests 09 September 2020

The Arrange, Act and Assert structure for unit tests

The Triple A (AAA) abbreviation: Arrange. Act and Assert is a way to structure your unit tests into 3 sections: Arrange: Assign variables, setup stubs, mocks »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Testing, Unit tests 23 May 2020

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 »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Unit tests, Test doubles 16 May 2020

xUnit - how to check if a call does not throw an exception

If you are moving from NUnit to xUnit, you will likely encounter the absence of the DoesNotThrow method in xUnit. At first I believed this did »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, XUnit, Unit tests 27 October 2019

What is a unit test?

In this post I describe what units tests are all about. It seems to me that in the last many years, the focus has drifted away »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Unit tests, Programming, Testing 31 January 2019

Deciding on what values to use for (unit) test cases

Often when writing tests one value can be as good as any other value. Such as if you need to apply a number within a range »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Testing, Unit tests, Integration tests, System tests 18 February 2018

Levels of automated tests in software development and programming - when to use what?

In this post I will describe some automated testing techniques. Testing is done to assure quality in our systems. But what is quality? Quality is that »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Testing, Unit tests, Integration tests, System tests 23 December 2017

Why do we use mocking for unit tests? and the use of test-doubles - Updated 2022

In order to understand how and why we use mocks for tests we need to understand different types of test doubles (implementations used for testing) and »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, NUnit, Unit tests, NSubstitute, Testing, Test doubles 09 December 2017
Page 1 of 1
Rss
Twitter
LinkedIn
profile for Peter Rasmussen at Stack Overflow, Q&A for professional and enthusiast programmers
Peter Daugaard Rasmussen - developer, Consultant, Blogger © 2022 Cookie policy