public void Test_GetMethodCallCount_Returns_Correct_Count() { Mock mock = new Mock(); int count = mock.GetMethodCallCount("TestMethod"); Assert.AreEqual(0, count); mock.MethodCalled("TestMethod", null); count = mock.GetMethodCallCount("TestMethod"); Assert.AreEqual(1, count); mock.MethodCalled("TestMethod", null); count = mock.GetMethodCallCount("TestMethod"); Assert.AreEqual(2, count); ArrayList args = new ArrayList(); args.Add(1); args.Add(2); mock.MethodCalled("OtherMethod", args); count = mock.GetMethodCallCount("TestMethod"); int otherCount = mock.GetMethodCallCount("OtherMethod"); Assert.AreEqual(2, count); Assert.AreEqual(1, otherCount); mock.MethodCalled("ThirdMethod", null); count = mock.GetMethodCallCount("TestMethod"); otherCount = mock.GetMethodCallCount("OtherMethod"); int thirdCount = mock.GetMethodCallCount("ThirdMethod"); Assert.AreEqual(2, count); Assert.AreEqual(1, otherCount); Assert.AreEqual(1, thirdCount); }
public void Test_GetMethodCallCount_Throws_ArgumentException_On_Null_Name() { Mock mock = new Mock(); mock.GetMethodCallCount(null); }