Hi
I'll try to answer all the questions:
in AAA how do I make an instance of a class?
That is simple:
var fake = Isolate.Fake.Instance<ClassToFake>();
Which one is AAA? Natural Mocks or Reflective Mocks?
The Isolator has three API's Natural mocks and reflective mocks are older API's while Arrange Act Assert (AAA) is the new API.
In the code samples you posted I saw usage in reflective mocks API
like in the line:
expected = MockManager.MockObject<ReadOnlyBO>().MockedInstance;
And usage of AAA
var fake = Isolate.Fake.Instance<GetBaseType>();
I had used reflection in my tests to get the base class of a mocked object and mock static and non-static protected calls to the base class. How would I do that in AAA?
Why not fake the calls in base class directly?
in the example below I'm faking static protected method:
Isolate.NonPublic.WhenCalled(typeof(BaseClass), "ProtectedStaticMethod").WillReturn(10);
:arrow: Isolate.NonPublic is the entry point for all non public methods.
:arrow: Because the method is public we are using the type of the class as the first argument of WhenCalled
Faking instance protected method
var fake = Isolate.Fake.Instance<BaseClass>();
Isolate.NonPublic.WhenCalled(fake, "ProtectedInstanceMethod").WillReturn(10);
:arrow: Again Isolate.NonPublic is the entry point.
:arrow: Now the first argument for WhenCalled is the fake object we created in the previous line and not lambda expression.
Also, I used to Verify all using MockManager.Verify is this action still possible in AAA?
Sure,
Here's how to verify public method:
Isolate.Verify.WasCalledWithAnyArguments(() => fake.SomeMethod());
Here's how to verify non public static method:
Isolate.Verify.NonPublic.WasCalled(typeof (BaseClass), "ProtectedStaticMethod");
Hope it clears things up.