James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


James Montemagno

Unit Testing

Unit Testing Plugins for Xamarin

So you love unit testing…. said no one ever, but you are forced to write unit tests and you want to use Plugins for Xamarin which are all singletons and need platform specific implementations or they will throw an exception in your tests…. what to do?!?!? Plugins are all interface based, which means all we have to do is use standard practices to not directly call the singleton, and setup our code to return the instance we want. In unit tests we can return a Mock (or Moq) of the interface, and in…

James Montemagno James Montemagno