Created
July 6, 2021 18:27
-
-
Save mr-pascal/2575d3131f0e5732e33c2e99095210ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //..... | |
| 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