Documentation ¶
Index ¶
- type CreateTransferInput
- type Repository
- type RepositoryMock
- func (mock *RepositoryMock) CreateTransfer(ctx context.Context, transfer entities.Transfer, accountID string) error
- func (mock *RepositoryMock) CreateTransferCalls() []struct{ ... }
- func (mock *RepositoryMock) GetTransfersByAccountID(ctx context.Context, accountID string) ([]entities.Transfer, error)
- func (mock *RepositoryMock) GetTransfersByAccountIDCalls() []struct{ ... }
- type UseCase
- type UseCaseMock
- func (mock *UseCaseMock) Create(ctx context.Context, input CreateTransferInput) (entities.Transfer, error)
- func (mock *UseCaseMock) CreateCalls() []struct{ ... }
- func (mock *UseCaseMock) GetTransfersByAccountID(ctx context.Context, accountID string) ([]entities.Transfer, error)
- func (mock *UseCaseMock) GetTransfersByAccountIDCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateTransferInput ¶
type Repository ¶
type RepositoryMock ¶
type RepositoryMock struct { // CreateTransferFunc mocks the CreateTransfer method. CreateTransferFunc func(ctx context.Context, transfer entities.Transfer, accountID string) error // GetTransfersByAccountIDFunc mocks the GetTransfersByAccountID method. GetTransfersByAccountIDFunc func(ctx context.Context, accountID string) ([]entities.Transfer, error) // contains filtered or unexported fields }
RepositoryMock is a mock implementation of Repository.
func TestSomethingThatUsesRepository(t *testing.T) { // make and configure a mocked Repository mockedRepository := &RepositoryMock{ CreateTransferFunc: func(ctx context.Context, transfer entities.Transfer, accountID string) error { panic("mock out the CreateTransfer method") }, GetTransfersByAccountIDFunc: func(ctx context.Context, accountID string) ([]entities.Transfer, error) { panic("mock out the GetTransfersByAccountID method") }, } // use mockedRepository in code that requires Repository // and then make assertions. }
func (*RepositoryMock) CreateTransfer ¶
func (mock *RepositoryMock) CreateTransfer(ctx context.Context, transfer entities.Transfer, accountID string) error
CreateTransfer calls CreateTransferFunc.
func (*RepositoryMock) CreateTransferCalls ¶
func (mock *RepositoryMock) CreateTransferCalls() []struct { Ctx context.Context Transfer entities.Transfer AccountID string }
CreateTransferCalls gets all the calls that were made to CreateTransfer. Check the length with:
len(mockedRepository.CreateTransferCalls())
func (*RepositoryMock) GetTransfersByAccountID ¶
func (mock *RepositoryMock) GetTransfersByAccountID(ctx context.Context, accountID string) ([]entities.Transfer, error)
GetTransfersByAccountID calls GetTransfersByAccountIDFunc.
func (*RepositoryMock) GetTransfersByAccountIDCalls ¶
func (mock *RepositoryMock) GetTransfersByAccountIDCalls() []struct { Ctx context.Context AccountID string }
GetTransfersByAccountIDCalls gets all the calls that were made to GetTransfersByAccountID. Check the length with:
len(mockedRepository.GetTransfersByAccountIDCalls())
type UseCaseMock ¶
type UseCaseMock struct { // CreateFunc mocks the Create method. CreateFunc func(ctx context.Context, input CreateTransferInput) (entities.Transfer, error) // GetTransfersByAccountIDFunc mocks the GetTransfersByAccountID method. GetTransfersByAccountIDFunc func(ctx context.Context, accountID string) ([]entities.Transfer, error) // contains filtered or unexported fields }
UseCaseMock is a mock implementation of UseCase.
func TestSomethingThatUsesUseCase(t *testing.T) { // make and configure a mocked UseCase mockedUseCase := &UseCaseMock{ CreateFunc: func(ctx context.Context, input CreateTransferInput) (entities.Transfer, error) { panic("mock out the Create method") }, GetTransfersByAccountIDFunc: func(ctx context.Context, accountID string) ([]entities.Transfer, error) { panic("mock out the GetTransfersByAccountID method") }, } // use mockedUseCase in code that requires UseCase // and then make assertions. }
func (*UseCaseMock) Create ¶
func (mock *UseCaseMock) Create(ctx context.Context, input CreateTransferInput) (entities.Transfer, error)
Create calls CreateFunc.
func (*UseCaseMock) CreateCalls ¶
func (mock *UseCaseMock) CreateCalls() []struct { Ctx context.Context Input CreateTransferInput }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedUseCase.CreateCalls())
func (*UseCaseMock) GetTransfersByAccountID ¶
func (mock *UseCaseMock) GetTransfersByAccountID(ctx context.Context, accountID string) ([]entities.Transfer, error)
GetTransfersByAccountID calls GetTransfersByAccountIDFunc.
func (*UseCaseMock) GetTransfersByAccountIDCalls ¶
func (mock *UseCaseMock) GetTransfersByAccountIDCalls() []struct { Ctx context.Context AccountID string }
GetTransfersByAccountIDCalls gets all the calls that were made to GetTransfersByAccountID. Check the length with:
len(mockedUseCase.GetTransfersByAccountIDCalls())