Suppose I have the following entity:
public class User
{
public int Id { get; set; }
public string Username { get; set; }
public Guid UserGuid {
If you are using Moq, you can use:
mockGuidService.SetupSequence(gs => gs.NewGuid())
.Returns( ...some value here...)
.Returns( ...another value here... );
I suppose you could also do the following:
mockGuidService.Setup(gs => gs.NewGuid())
.Returns(() => ...compute a value here...);
Still, unless you are just supplying a random value within the return function, knowledge of order still seems to be important.