Пример #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;
        }