I have a test like this:
[TestCase("~/page/myaction")]
public void Page_With_Custom_Action(string pat
The existing answers are great, but I thought I'd throw in my alternative which just uses System.Collections.Generic.Queue
and doesn't require any special knowledge of the mocking framework - since I didn't have any when I wrote it! :)
var pageModel = new Mock();
IPageModel pageModelNull = null;
var pageModels = new Queue();
pageModels.Enqueue(pageModelNull);
pageModels.Enqueue(pageModel.Object);
Then...
repository.Setup(x => x.GetPageByUrl(path)).Returns(pageModels.Dequeue);