示例#1
0
        public void Test_Args_Getter()
        {
            ArrayList args = new ArrayList();
            args.Add(4);
            args.Add(5);
            MethodCall call = new MethodCall("TestMethod", args);

            Assert.AreEqual(args, call.Args);
        }
示例#2
0
 public void Test_Null_Method_Name_Throws_ArgumentException_In_Ctor()
 {
     MethodCall call = new MethodCall(null, null);
 }
示例#3
0
        public void Test_MethodName_Getter()
        {
            MethodCall call = new MethodCall("TestMethod", null);

            Assert.AreEqual("TestMethod", call.MethodName);
        }
示例#4
0
        /// <summary>
        /// This method is used to replace the body of the method being mocked.
        /// </summary>
        /// <param name="methodName">Name of the method that was called.</param>
        /// <param name="args">ArrayList containing the arguments of the method.</param>
        /// <returns>Returns the value specified to be returned by SetMethodReturnValue.</returns>
        public Object MethodCalled(string methodName, ArrayList args)
        {
            if(methodName == null || methodName.Length == 0)
            {
                string msg = "The provided methodName cannot be empty.";
                throw new ArgumentException(msg);
            }

            MethodCall methodCall = new MethodCall(methodName, args);
            this.m_methodCalls.Add(methodCall);

            int callCount = this.GetMethodCallCount(methodName);
            Object returnValue = this.GetMethodReturnValue(methodName, callCount);

            return returnValue;
        }