Showing all posts tagged: 'unit test'

A 3-post collection

Unit testing with .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 3 years ago? .NET Core may be in RTM but it's still moving at a very fast pace and there are still a lot of changes to the framework. The team announced ago .NET Standard 2.0 which comes with a few breaking changes. On top of that the tooling around .NET Core is …[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]