transfer

package
v0.0.0-...-308d6b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDomainError

func IsDomainError(err error) bool

Check if some error belongs to the transfer domain

Types

type Repository

type Repository interface {
	PerformTransference(context.Context, entities.PerformTransferenceInput) error
	ListTransfersByAccountID(context.Context, string) ([]entities.Transfer, error)
}

type RepositoryMock

type RepositoryMock struct {
	// ListTransfersByAccountIDFunc mocks the ListTransfersByAccountID method.
	ListTransfersByAccountIDFunc func(contextMoqParam context.Context, s string) ([]entities.Transfer, error)

	// PerformTransferenceFunc mocks the PerformTransference method.
	PerformTransferenceFunc func(contextMoqParam context.Context, performTransferenceInput entities.PerformTransferenceInput) 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{
		ListTransfersByAccountIDFunc: func(contextMoqParam context.Context, s string) ([]entities.Transfer, error) {
			panic("mock out the ListTransfersByAccountID method")
		},
		PerformTransferenceFunc: func(contextMoqParam context.Context, performTransferenceInput entities.PerformTransferenceInput) error {
			panic("mock out the PerformTransference method")
		},
	}

	// use mockedRepository in code that requires Repository
	// and then make assertions.

}

func (*RepositoryMock) ListTransfersByAccountID

func (mock *RepositoryMock) ListTransfersByAccountID(contextMoqParam context.Context, s string) ([]entities.Transfer, error)

ListTransfersByAccountID calls ListTransfersByAccountIDFunc.

func (*RepositoryMock) ListTransfersByAccountIDCalls

func (mock *RepositoryMock) ListTransfersByAccountIDCalls() []struct {
	ContextMoqParam context.Context
	S               string
}

ListTransfersByAccountIDCalls gets all the calls that were made to ListTransfersByAccountID. Check the length with:

len(mockedRepository.ListTransfersByAccountIDCalls())

func (*RepositoryMock) PerformTransference

func (mock *RepositoryMock) PerformTransference(contextMoqParam context.Context, performTransferenceInput entities.PerformTransferenceInput) error

PerformTransference calls PerformTransferenceFunc.

func (*RepositoryMock) PerformTransferenceCalls

func (mock *RepositoryMock) PerformTransferenceCalls() []struct {
	ContextMoqParam          context.Context
	PerformTransferenceInput entities.PerformTransferenceInput
}

PerformTransferenceCalls gets all the calls that were made to PerformTransference. Check the length with:

len(mockedRepository.PerformTransferenceCalls())

type UseCase

type UseCase interface {
	//? see the param origID
	List(ctx context.Context, origID string) ([]entities.Transfer, error)
	Perform(context.Context, entities.CreateTransferInput) (*entities.Transfer, error)
}

type UseCaseMock

type UseCaseMock struct {
	// ListFunc mocks the List method.
	ListFunc func(ctx context.Context, origID string) ([]entities.Transfer, error)

	// PerformFunc mocks the Perform method.
	PerformFunc func(contextMoqParam context.Context, createTransferInput entities.CreateTransferInput) (*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{
		ListFunc: func(ctx context.Context, origID string) ([]entities.Transfer, error) {
			panic("mock out the List method")
		},
		PerformFunc: func(contextMoqParam context.Context, createTransferInput entities.CreateTransferInput) (*entities.Transfer, error) {
			panic("mock out the Perform method")
		},
	}

	// use mockedUseCase in code that requires UseCase
	// and then make assertions.

}

func (*UseCaseMock) List

func (mock *UseCaseMock) List(ctx context.Context, origID string) ([]entities.Transfer, error)

List calls ListFunc.

func (*UseCaseMock) ListCalls

func (mock *UseCaseMock) ListCalls() []struct {
	Ctx    context.Context
	OrigID string
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedUseCase.ListCalls())

func (*UseCaseMock) Perform

func (mock *UseCaseMock) Perform(contextMoqParam context.Context, createTransferInput entities.CreateTransferInput) (*entities.Transfer, error)

Perform calls PerformFunc.

func (*UseCaseMock) PerformCalls

func (mock *UseCaseMock) PerformCalls() []struct {
	ContextMoqParam     context.Context
	CreateTransferInput entities.CreateTransferInput
}

PerformCalls gets all the calls that were made to Perform. Check the length with:

len(mockedUseCase.PerformCalls())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL