Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserRepositoryMock ¶
type UserRepositoryMock struct {
// LookupFunc mocks the Lookup method.
LookupFunc func(id int64) (cleanarch.User, error)
// StoreFunc mocks the Store method.
StoreFunc func(user cleanarch.User) (int64, error)
// contains filtered or unexported fields
}
UserRepositoryMock is a mock implementation of cleanarch.UserRepository.
func TestSomethingThatUsesUserRepository(t *testing.T) {
// make and configure a mocked cleanarch.UserRepository
mockedUserRepository := &UserRepositoryMock{
LookupFunc: func(id int64) (cleanarch.User, error) {
panic("mock out the Lookup method")
},
StoreFunc: func(user cleanarch.User) (int64, error) {
panic("mock out the Store method")
},
}
// use mockedUserRepository in code that requires cleanarch.UserRepository
// and then make assertions.
}
func (*UserRepositoryMock) Lookup ¶
func (mock *UserRepositoryMock) Lookup(id int64) (cleanarch.User, error)
Lookup calls LookupFunc.
func (*UserRepositoryMock) LookupCalls ¶
func (mock *UserRepositoryMock) LookupCalls() []struct { ID int64 }
LookupCalls gets all the calls that were made to Lookup. Check the length with:
len(mockedUserRepository.LookupCalls())
func (*UserRepositoryMock) Store ¶
func (mock *UserRepositoryMock) Store(user cleanarch.User) (int64, error)
Store calls StoreFunc.
func (*UserRepositoryMock) StoreCalls ¶
func (mock *UserRepositoryMock) StoreCalls() []struct { User cleanarch.User }
StoreCalls gets all the calls that were made to Store. Check the length with:
len(mockedUserRepository.StoreCalls())
Click to show internal directories.
Click to hide internal directories.