Skip to content

Instantly share code, notes, and snippets.

@mr-pascal
Created July 6, 2021 18:27
Show Gist options
  • Select an option

  • Save mr-pascal/2575d3131f0e5732e33c2e99095210ed to your computer and use it in GitHub Desktop.

Select an option

Save mr-pascal/2575d3131f0e5732e33c2e99095210ed to your computer and use it in GitHub Desktop.
//.....
const sumMethodName = "Sum"
const multiplyMethodName = "Multiply"
type AppHandlerFake struct {
// method name -> call -> params
Calls map[string][][]interface{}
}
func (a *AppHandlerFake) Sum(x, y int) (r Result) {
b := a.Calls[sumMethodName]
c := []interface{}{x, y}
a.Calls[sumMethodName] = append(b, c)
r.Value = 7
return
}
func (a *AppHandlerFake) Multiply(x, y int) (r Result) {
b := a.Calls[multiplyMethodName]
c := []interface{}{x, y}
a.Calls[multiplyMethodName] = append(b, c)
r.Value = 10
return
}
//.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment