Skip to content

Instantly share code, notes, and snippets.

@mattbrailsford
Created April 13, 2016 14:32
Show Gist options
  • Save mattbrailsford/d316f7e4346ddc2b3b1882092fbb3266 to your computer and use it in GitHub Desktop.
Save mattbrailsford/d316f7e4346ddc2b3b1882092fbb3266 to your computer and use it in GitHub Desktop.
public interface IDictionaryValueResolver
{
public string ResolveValue(string key);
}
public class ConcreteDictionaryValueResolver : IDictionaryValueResolver
{
public string ResolveValue(string key) {
// Do your thing
}
}
public class MockDictionaryValueResolver : IDictionaryValueResolver
{
public string ResolveValue(string key) {
// Do your thing
}
}
public class DictionaryValueResolverFactory {
private static IDictionaryValueResolver _resolver;
public static IDictionaryValueResolver Get()
{
if(_resolver == null) {
_resolver = new ConcreteDictionaryValueResolver();
}
return _resolver;
}
internal static Set(IDictionaryValueResolver value) {
_resolver = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment