Showing all posts tagged: 'unit test'

A 3-post collection

Getting started with testing in .NET Core

.NET Core has been in production (RTM) since June 2016, when it was officially released at the Red Had Summit by Scott Hanselman. What a glorious moment! Announcing an open source framework at a conference for Linux! Who would have thought that this would be possible some years ago? .NET Core 3.1 is the current (LTS) version but I'm also really looking forward to .NET 5, the one that unifies all .NET frameworks and becomes the next best version of .NET. You can download .NET 5 and take it for a spin today! Unit testing your apps is an …[read more]


Improve your unit tests with Moq and Mock.Of<>()

Spending my days writing lots of unit tests lately...You know the drill. For most of my tests, I like to use Moq, the .NET mocking library that allows you to mock objects and services. It's one of the best libraries for complementing and supporting unit tests. So today, I came across the Mock.Of<T>(). When creating a mock, we tend to use the following syntax: var mockService = new Mock<ISomeService>(); And then we setup the mock with the appropriate property values and methods in order to use it in our unit tests. So, in …[read more]


An introduction to JavaScript Unit Testing with qUnit and Sinon.js

If you are developing for the web – apps or websites, then it is almost impossible to escape JavaScript. At some point, you will write some client-side code and as the application grows and the requirements become more complex, your JavaScript code is bound to grow with it. Like with every other complex piece of code, we need to be confident that the code behaves as expected. It doesn’t matter if you decide to use TDD or not, what’s important is to test your code. You can do this manually, very tedious and error prone, or programmatically. The choice …[read more]