Skip to content

Instantly share code, notes, and snippets.

@15mgm15
Created December 2, 2017 19:22
Show Gist options
  • Save 15mgm15/e34d09f795e50606b1dea9899a52bf58 to your computer and use it in GitHub Desktop.
Save 15mgm15/e34d09f795e50606b1dea9899a52bf58 to your computer and use it in GitHub Desktop.
public class DependencyServiceStub : IDependencyService
{
readonly Dictionary<Type, object> registeredServices = new Dictionary<Type, object>();
public void Register<T>(object impl)
{
registeredServices[typeof(T)] = impl;
}
public T Get<T>() where T : class
{
var service = (T)registeredServices[typeof(T)];
return service;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment