C# Moq allows to return data based on call arguments.
testify/mock don't. It's possible to do using Run, but it's a big mess of code.
It would be great to have something like this:
myMock.On("Load", mock.AnythingOfType("string")).ReturnFn(func (token string) (*MyObj, error) {
if isValid(token) {
return someStuff(), nil
} else {
return nil, errors.New("Oh!")
}
})
I can send a PR if someone like this idea.