-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ryan Moran
committed
Sep 7, 2021
1 parent
cf71c4d
commit 3acf554
Showing
5 changed files
with
56 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package fakes | ||
|
||
import ( | ||
"bytes" | ||
"io" | ||
"sync" | ||
) | ||
|
||
type SomeNamedInterface struct { | ||
SomeMethodCall struct { | ||
sync.Mutex | ||
CallCount int | ||
Receives struct { | ||
SomeParam *bytes.Buffer | ||
} | ||
Returns struct { | ||
SomeResult io.Reader | ||
} | ||
Stub func(*bytes.Buffer) io.Reader | ||
} | ||
} | ||
|
||
func (f *SomeNamedInterface) SomeMethod(param1 *bytes.Buffer) io.Reader { | ||
f.SomeMethodCall.Lock() | ||
defer f.SomeMethodCall.Unlock() | ||
f.SomeMethodCall.CallCount++ | ||
f.SomeMethodCall.Receives.SomeParam = param1 | ||
if f.SomeMethodCall.Stub != nil { | ||
return f.SomeMethodCall.Stub(param1) | ||
} | ||
return f.SomeMethodCall.Returns.SomeResult | ||
} |
This file contains 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
This file contains 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
This file contains 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