Hi
I hope I understands you correctly so please fix if I'm wrong :shock:
For Scenario 1 View.ListOfA is null:
We need to path mocked IAController object to the APresenter class
and set IAController.GetAList method to return null
Example:
[TestMethod]
public void TestListOfAIsNull()
{
IAController controller = (IAController)RecorderManager.CreateMockedObject(typeof(IAController));
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
recorder.ExpectAndReturn(controller.GetAList(), null);
}
APresenter aPresenter = new APresenter(controller);
//call expectations here ...
}
For Scenario 2 View.ListOfA is not null and count > 0:
Similar to the test before but now set GetAList method to return a list
Example
[TestMethod]
public void TestListOfAIsNotNull()
{
AList retList = new AList();
//retList.Add() ...
IAController controller = (IAController)RecorderManager.CreateMockedObject(typeof(IAController));
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
recorder.ExpectAndReturn(controller.GetAList(), retList);
}
APresenter aPresenter = new APresenter(controller);
//call expectation here ...
}