示例#1
0
 public MockMethod(Type type, string name)
 {
     this.klass   = type;
     this.Name    = name;
     this.methods = MethodInfoCache.FindMethod(klass, name);
     if (methods.Count() == 0)
     {
         throw new ArgumentException("There is no method " + name + " in type " + type);
     }
     this.results = new Dictionary <object[], object>();
 }
示例#2
0
 public MockMethod With(params object[] args)
 {
     if (this.args != null)
     {
         throw new InvalidOperationException("You already called With() !!!!  Cannot call it twice without calling Return() first!");
     }
     if (meth == null)
     {
         this.meth = MethodInfoCache.FindMethod(klass, Name, args.Select(a => a.GetType()).ToArray());
     }
     this.args = args;
     return(this);
 }