예제 #1
0
        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);
        }
예제 #2
0
 public void Register(Type type, IStubProvider stubProvider) => Register(type.FullName, stubProvider);
예제 #3
0
 public void Register(Type type, IStubProvider stubProvider)
 {
     _typeFuncs.Add(type.FullName, stubProvider.Provide);
 }
예제 #4
0
 public void Register <T>(IStubProvider <T> stubProvider) => Register(typeof(T).FullName, stubProvider);
예제 #5
0
 public void Register <T>(IStubProvider <T> stubProvider)
 {
     _typeFuncs.Add(typeof(T).FullName, () => stubProvider.Provide());
 }