Created
April 22, 2018 19:07
-
-
Save petergtz/e1bae6c1751b789ae8641866944962a4 to your computer and use it in GitHub Desktop.
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
// Interface: | |
type PhoneBook interface { | |
GetPhoneNumber(name string) string | |
} | |
// Test: | |
// creating the mock | |
phoneBook := NewMockPhoneBook() | |
// stubbing: | |
When(phoneBook.GetPhoneNumber("Tom")).ThenReturn("345-123-789") | |
When(phoneBook.GetPhoneNumber("Dan")).ThenReturn("123-456-000") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment