private void Register(string typeName, IStubProvider stubProvider) { if (_typeFuncs.ContainsKey(typeName)) { var existing = _typeFuncs[typeName]; throw new ArgumentException( $"Cannot register \"{stubProvider.GetType().FullName}\" for the type \"{typeName}" + $"¨{Environment.NewLine}" + $"The type is already registered with: {existing.GetType().FullName}"); } _typeFuncs.Add(typeName, stubProvider.Provide); }
public void Register(Type type, IStubProvider stubProvider) => Register(type.FullName, stubProvider);
public void Register(Type type, IStubProvider stubProvider) { _typeFuncs.Add(type.FullName, stubProvider.Provide); }
public void Register <T>(IStubProvider <T> stubProvider) => Register(typeof(T).FullName, stubProvider);
public void Register <T>(IStubProvider <T> stubProvider) { _typeFuncs.Add(typeof(T).FullName, () => stubProvider.Provide()); }