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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hei,

I want to rewrite some of old code that use natural mocks with RecordExpectations. The code is like this:

using(RecordExpectations recorder = new RecordExpectations())
{
A a = new A(null, null);
recorder.CallOriginal().CheckArguments(new Assign("1"), new Assign("2"));
...
}

So what I am achieving here is mocking just a call to a constructor of A with a call with specific arguments.

But how would this look with AAA? I tried this:

A a = new ("1", "2");
Isolate.Fake.Instance<A>(Member.CallOriginal);
Isolate.SwapNextInstance<A>().With(a);

This does not work: I am getting null reference exception in SwapNextInstance call. But how can I mock a creation of a instance of A with a call to a constructor with specific arguments?
asked by vagif (19.4k points)

1 Answer

0 votes
Hi

Currently the 'Assign' feature is not supported with AAA syntax. :(
That said, we are planning to bring the AAA API to have the same features
of the natural mocks API.
answered by ohad (35.4k points)
...