Tech Blog

Unit Testing with Mocks

By: Chris Dunn on Tue Jul 16, 2019 (9 min read)

If you are interested in an academic, or more intellectual understanding of Mocks, Stubs, Fakes which collectively are known as Test Doubles, it's always a good idea to visit Martin Fowler. Stubs Aren't Fakes. For this post I want to talk about testing in isolation using Mocks and Dependency Injection.  The examples in this post will be using Moq(https://github.com/moq/moq) but there a number of other options out there to choose from. Making your code testable In order to unit test in isolation, ...

Typed AppSettings in .net core

By: Chris Dunn on Tue Apr 9, 2019 (5 min read)

It's always easier to work with typed information in a program than trying to remember string keys in a configuration file. So when working with the appsettings.json file in .net core, I advise you load the configuration file into a class object and work with the object directly, instead of GetSection() repeatedly throughout your code. It's also a good idea to create the class object as a service so you can inject it into controllers for ease of use while still maintaining test-ability. I'll do ...

Copyright 2019 Cidean, LLC. All rights reserved.

Proudly running Umbraco 7. This site is responsive with the help of Foundation 5.