public Call GetCall(CallInput input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return FindCalls(c => input.Equals(c)).Single();
 }
 private Type ResolveTargetType(CallInput input)
 {
     Type targetType = _targetTypeResolver.Resolve(input.TargetType);
     if (targetType == null)
     {
         throw new ArgumentException(string.Format("Can't find target type '{0}'", input.TargetType));
     }
     return targetType;
 }
 public ICallPlayback Resolve(CallInput input)
 {
     ValidateInput(input);
     Type targetType = ResolveTargetType(input);
     MethodInfo methodInfo = ResolveMethodInfo(input, targetType);
     object targetInstance = ResolveTargetInstance(input, targetType);
     ICallPlayback result = new CallPlaybackUsinReflection(targetInstance, methodInfo, input.Arguments);
     return result;
 }
 private static void ValidateInput(CallInput input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     if (string.IsNullOrWhiteSpace(input.TargetType))
     {
         // ReSharper disable NotResolvedInText
         throw new ArgumentNullException("input.TargetType");
         // ReSharper restore NotResolvedInText
     }
     if (string.IsNullOrWhiteSpace(input.Method))
     {
         // ReSharper disable NotResolvedInText
         throw new ArgumentNullException("input.Method");
         // ReSharper restore NotResolvedInText
     }
 }
 private object ResolveTargetInstance(CallInput input, Type targetType)
 {
     object targetInstance = _targetInstanceResolver.Resolve(targetType);
     if (targetInstance == null)
     {
         throw new ArgumentException(string.Format("Instance of target type '{0}' not found", input.TargetType));
     }
     return targetInstance;
 }
 private static MethodInfo ResolveMethodInfo(CallInput input, Type targetType)
 {
     MethodInfo methodInfo = targetType.GetMethod(input.Method);
     if (methodInfo == null)
     {
         throw new ArgumentException(string.Format("Method '{0}' not found in target type '{1}'", input.Method,
             input.TargetType));
     }
     return methodInfo;
 }
 public string GetFileName(CallInput input)
 {
     var sb = new StringBuilder();
     sb.Append(input.CallNumber.ToString(CultureInfo.InvariantCulture).PadLeft(7, '0')).Append('_').Append(input.TargetType.Replace(", ", "-")).Append('_').Append(input.Method).Append(".json");
     return Path.Combine(_directory, sb.ToString());
 }