I have a test like this:
[TestCase("~/page/myaction")]
public void Page_With_Custom_Action(string pat
You can use a callback when setting up your mock object. Take a look at the example from the Moq Wiki (http://code.google.com/p/moq/wiki/QuickStart).
// returning different values on each invocation
var mock = new Mock();
var calls = 0;
mock.Setup(foo => foo.GetCountThing())
.Returns(() => calls)
.Callback(() => calls++);
// returns 0 on first invocation, 1 on the next, and so on
Console.WriteLine(mock.Object.GetCountThing());
Your setup might look like this:
var pageObject = pageModel.Object;
repository.Setup(x => x.GetPageByUrl(path)).Returns(() => pageObject).Callback(() =>
{
// assign new value for second call
pageObject = new PageModel();
});