MockGetCallCount Method (String)

Typemock Isolator Developer Guide
Return the amount of times a method has been called

Namespace:  TypeMock
Assembly:  TypeMock (in TypeMock.dll) Version: 9.3.6.0 (9.3.6.0)
Syntax

public int GetCallCount(
	string method
)

Parameters

method
Type: SystemString
String representation of Method

Return Value

Type: Int32
Number of times the method has been called
Remarks

Can be used as part of a validation.
Examples

In the following example we validate that the doSomething() Method has been called 3 times, while keeping the original functionality (not mocked)
[Test]
public void Test()
{
    Mock mock = MockManager.Mock(typeof(TestedClass));
    TestedClass t = new TestedClass();
    t.doSomething();
    t.doSomething();
    t.doSomething();
    Assert.AreEqual(3,mock.GetCallCount("doSomething"));
}
For Properties and Indexers see GetCallPropertyGetCounter(String) , GetCallPropertySetCounter(String) and GetCallIndexerCounter
Note Note
mock.GetCallCount("doSomething") is equivalent to MockManager.CalledCounter("TestClassLibrary.TestedClass","doSomething") See CalledCounter(String, String)
See Also

Reference