Let's see if I understood your question.. You have different solutions:
If you already know the Id that is going to be used you can do this:
var _viewModelFactory = MockRepository.GenerateStub<IViewModelFactory>();
var id = 1;
viewModelFactory.Stub(x => x.Create<ViewModel1>(id))
.Return(new ViewModel1(id));
If you don't know the id but you don't care about which one is going to be used because you will always return your viewmodel with the same id, you can do this:
var _viewModelFactory = MockRepository.GenerateStub<IViewModelFactory>();
viewModelFactory.Stub(x => x.Create<ViewModel1>(0))
.IgnoreArguments()
.Return(new ViewModel1(10));
If you want to create a viewmodel with the id that you get even though you don't know it while defining the test:
var _viewModelFactory = MockRepository.GenerateStub<IViewModelFactory>();
viewModelFactory.Stub(x => x.Create<ViewModel1>(Arg<int>.Is.Anything))
.Return(null)
.WhenCalled(x => {
var id = (int)x.Arguments[0];
x.ReturnValue = new ViewModel1(id);
});
NOTE: I can't test the code right now, but I think it should work!