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?