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

I crush code and share it, publish NuGet packages, speak at conferences, upload videos, pretend I am good at playing video games, tweet up a storm, drink gallons of coffee, and ride my bike. Checkout my monthly newsletter that you should subscribe to!