chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
What would be the AAA API equivalent to ExpectGet from previous API with expected # of calls argument

ExpectGet Method (String, Object, Int32)

Specifically, how would you use the AAA API to ensure that a Get was called a specific number of times?

asked by dplante (1.1k points)

1 Answer

0 votes
Getting the hang of AAA API is very easy - it replaces the old record/replay model, and allows you to set and verify your expectations easily. I suggest you read our "Getting Started with AAA API" to learn how to use it.

As to your question, suppose you have a class with a get property, like:

public class Person
    private string person;

    public string Name { get { return person; } }

In order to have the property return a value you want, simply use "WhenCalled" and "WillReturn":

Person person = ...
Isolate.WhenCalled(() => person.Name).WillReturn("David");

Assert.AreEqual("David", person.Name);
answered by igal (5.7k points)