Example #1
0
        public void Test_GetMethodArgs_Returns_Correct_Args()
        {
            ArrayList args = new ArrayList();
            args.Add(1);
            args.Add(2);

            Mock mock = new Mock();
            mock.MethodCalled("TestMethod", args);
            ArrayList argsOut = mock.GetMethodArgs("TestMethod", 1);

            Assert.AreEqual(1, argsOut[0]);
            Assert.AreEqual(2, argsOut[1]);

            args = new ArrayList();
            args.Add(3);
            args.Add(4);

            mock.MethodCalled("TestMethod", args);
            argsOut = mock.GetMethodArgs("TestMethod", 2);

            Assert.AreEqual(3, argsOut[0]);
            Assert.AreEqual(4, argsOut[1]);

            args = new ArrayList();
            args.Add(5);
            args.Add(6);

            mock.MethodCalled("TestMethod", args);
            argsOut = mock.GetMethodArgs("TestMethod", 3);

            Assert.AreEqual(5, argsOut[0]);
            Assert.AreEqual(6, argsOut[1]);
        }
Example #2
0
 public void Test_GetMethodArgs_Throws_Exception_If_CallCount_Too_High()
 {
     Mock mock = new Mock();
     mock.MethodCalled("TestMethod", null);
     mock.GetMethodArgs("TestMethod", 2);
 }
Example #3
0
 public void Test_GetMethodArgs_Throws_ArgumentException_On_Null_Name()
 {
     Mock mock = new Mock();
     mock.GetMethodArgs(null, 1);
 }
Example #4
0
 public void Test_GetMethodArgs_Throws_ArgumentException_On_Empty_Name()
 {
     Mock mock = new Mock();
     mock.GetMethodArgs("", 1);
 }
Example #5
0
 public void Test_GetMethodArgs_Throws_ArgumentException_On_CallCount_Less_Than_One()
 {
     Mock mock = new Mock();
     mock.GetMethodArgs("TestName", 0);
 }