MockManagerCalledCounter Method (String, 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 static int CalledCounter(
	string type,
	string methodName
)

Parameters

type
Type: SystemString
String representation of Type
methodName
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()
{
    // init collecting on
    MockManager.Init(true);
    TestedClass t = new TestedClass();
    t.doSomething();
    t.doSomething();
    t.doSomething();
    Assert.AreEqual(3,MockManager.CalledCounter("TestClassLibrary.TestedClass","doSomething"));
}
For Properties and Indexers see CalledPropertyGetCounter(String, String) , CalledPropertySetCounter(String, String) and CalledIndexerCounter(String)
Note Note
Calls from Types of the System.* namespace will not be collected until the type is mocked
See Also

Reference