-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
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.
gfronza, pierrebeaucamp, timonwong, sivachandran, peterhuene and 52 more