Blog Posts for: Mocking

Unit testing with Dates

07 April 2015

Overview In a recent app we developed, there was a particular piece of code which monitored user accounts and would send out a notification before their subscription expires. There were various sets of notifications which we emailed to them; one a week before expiration, one 3 days before, one the day before expiration, and a final one once the subscription has actually expired. We needed to write unit tests for all these different scenarios to ensure that the correct emails go out on the correct dates.

Mocking an abstract class using NSubstitute

15 October 2013

For the development of One Love, I make use of the wonderful MvvmCross library for implementing the MVVM pattern. This allows me to have a LOT of shared code across all platforms, and also allows me to implement unit testing across all that shared code. There are of course certain things which are platform specific and for that I use the dependency injection which comes standard with MvvmCross. For the unit tests I use a mocking framework to create mocks which are then passed into the constructors of the classes under test.