mocks

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RepositoryMock

type RepositoryMock struct {
	// CreateTransactionFunc mocks the CreateTransaction method.
	CreateTransactionFunc func(contextMoqParam context.Context, transaction entities.Transaction) error

	// GetAnalyticAccountBalanceFunc mocks the GetAnalyticAccountBalance method.
	GetAnalyticAccountBalanceFunc func(contextMoqParam context.Context, account vos.Account) (vos.AccountBalance, error)

	// GetBoundedAccountBalanceFunc mocks the GetBoundedAccountBalance method.
	GetBoundedAccountBalanceFunc func(contextMoqParam context.Context, account vos.Account, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (vos.AccountBalance, error)

	// GetSyntheticAccountBalanceFunc mocks the GetSyntheticAccountBalance method.
	GetSyntheticAccountBalanceFunc func(contextMoqParam context.Context, account vos.Account) (vos.AccountBalance, error)

	// GetSyntheticReportFunc mocks the GetSyntheticReport method.
	GetSyntheticReportFunc func(contextMoqParam context.Context, account vos.Account, n int, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (*vos.SyntheticReport, error)

	// ListAccountEntriesFunc mocks the ListAccountEntries method.
	ListAccountEntriesFunc func(contextMoqParam context.Context, accountEntryRequest vos.AccountEntryRequest) ([]vos.AccountEntry, pagination.Cursor, error)
	// contains filtered or unexported fields
}

RepositoryMock is a mock implementation of domain.Repository.

func TestSomethingThatUsesRepository(t *testing.T) {

	// make and configure a mocked domain.Repository
	mockedRepository := &RepositoryMock{
		CreateTransactionFunc: func(contextMoqParam context.Context, transaction entities.Transaction) error {
			panic("mock out the CreateTransaction method")
		},
		GetAnalyticAccountBalanceFunc: func(contextMoqParam context.Context, account vos.Account) (vos.AccountBalance, error) {
			panic("mock out the GetAnalyticAccountBalance method")
		},
		GetBoundedAccountBalanceFunc: func(contextMoqParam context.Context, account vos.Account, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (vos.AccountBalance, error) {
			panic("mock out the GetBoundedAccountBalance method")
		},
		GetSyntheticAccountBalanceFunc: func(contextMoqParam context.Context, account vos.Account) (vos.AccountBalance, error) {
			panic("mock out the GetSyntheticAccountBalance method")
		},
		GetSyntheticReportFunc: func(contextMoqParam context.Context, account vos.Account, n int, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (*vos.SyntheticReport, error) {
			panic("mock out the GetSyntheticReport method")
		},
		ListAccountEntriesFunc: func(contextMoqParam context.Context, accountEntryRequest vos.AccountEntryRequest) ([]vos.AccountEntry, pagination.Cursor, error) {
			panic("mock out the ListAccountEntries method")
		},
	}

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

}

func (*RepositoryMock) CreateTransaction

func (mock *RepositoryMock) CreateTransaction(contextMoqParam context.Context, transaction entities.Transaction) error

CreateTransaction calls CreateTransactionFunc.

func (*RepositoryMock) CreateTransactionCalls

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

CreateTransactionCalls gets all the calls that were made to CreateTransaction. Check the length with:

len(mockedRepository.CreateTransactionCalls())

func (*RepositoryMock) GetAnalyticAccountBalance added in v0.6.0

func (mock *RepositoryMock) GetAnalyticAccountBalance(contextMoqParam context.Context, account vos.Account) (vos.AccountBalance, error)

GetAnalyticAccountBalance calls GetAnalyticAccountBalanceFunc.

func (*RepositoryMock) GetAnalyticAccountBalanceCalls added in v0.6.0

func (mock *RepositoryMock) GetAnalyticAccountBalanceCalls() []struct {
	ContextMoqParam context.Context
	Account         vos.Account
}

GetAnalyticAccountBalanceCalls gets all the calls that were made to GetAnalyticAccountBalance. Check the length with:

len(mockedRepository.GetAnalyticAccountBalanceCalls())

func (*RepositoryMock) GetBoundedAccountBalance added in v0.7.0

func (mock *RepositoryMock) GetBoundedAccountBalance(contextMoqParam context.Context, account vos.Account, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (vos.AccountBalance, error)

GetBoundedAccountBalance calls GetBoundedAccountBalanceFunc.

func (*RepositoryMock) GetBoundedAccountBalanceCalls added in v0.7.0

func (mock *RepositoryMock) GetBoundedAccountBalanceCalls() []struct {
	ContextMoqParam context.Context
	Account         vos.Account
	TimeMoqParam1   time.Time
	TimeMoqParam2   time.Time
}

GetBoundedAccountBalanceCalls gets all the calls that were made to GetBoundedAccountBalance. Check the length with:

len(mockedRepository.GetBoundedAccountBalanceCalls())

func (*RepositoryMock) GetSyntheticAccountBalance added in v0.6.0

func (mock *RepositoryMock) GetSyntheticAccountBalance(contextMoqParam context.Context, account vos.Account) (vos.AccountBalance, error)

GetSyntheticAccountBalance calls GetSyntheticAccountBalanceFunc.

func (*RepositoryMock) GetSyntheticAccountBalanceCalls added in v0.6.0

func (mock *RepositoryMock) GetSyntheticAccountBalanceCalls() []struct {
	ContextMoqParam context.Context
	Account         vos.Account
}

GetSyntheticAccountBalanceCalls gets all the calls that were made to GetSyntheticAccountBalance. Check the length with:

len(mockedRepository.GetSyntheticAccountBalanceCalls())

func (*RepositoryMock) GetSyntheticReport added in v0.5.0

func (mock *RepositoryMock) GetSyntheticReport(contextMoqParam context.Context, account vos.Account, n int, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (*vos.SyntheticReport, error)

GetSyntheticReport calls GetSyntheticReportFunc.

func (*RepositoryMock) GetSyntheticReportCalls added in v0.5.0

func (mock *RepositoryMock) GetSyntheticReportCalls() []struct {
	ContextMoqParam context.Context
	Account         vos.Account
	N               int
	TimeMoqParam1   time.Time
	TimeMoqParam2   time.Time
}

GetSyntheticReportCalls gets all the calls that were made to GetSyntheticReport. Check the length with:

len(mockedRepository.GetSyntheticReportCalls())

func (*RepositoryMock) ListAccountEntries added in v0.5.0

func (mock *RepositoryMock) ListAccountEntries(contextMoqParam context.Context, accountEntryRequest vos.AccountEntryRequest) ([]vos.AccountEntry, pagination.Cursor, error)

ListAccountEntries calls ListAccountEntriesFunc.

func (*RepositoryMock) ListAccountEntriesCalls added in v0.5.0

func (mock *RepositoryMock) ListAccountEntriesCalls() []struct {
	ContextMoqParam     context.Context
	AccountEntryRequest vos.AccountEntryRequest
}

ListAccountEntriesCalls gets all the calls that were made to ListAccountEntries. Check the length with:

len(mockedRepository.ListAccountEntriesCalls())

type UseCaseMock

type UseCaseMock struct {
	// CreateTransactionFunc mocks the CreateTransaction method.
	CreateTransactionFunc func(contextMoqParam context.Context, transaction entities.Transaction) error

	// GetAccountBalanceFunc mocks the GetAccountBalance method.
	GetAccountBalanceFunc func(contextMoqParam context.Context, getAccountBalanceInput domain.GetAccountBalanceInput) (vos.AccountBalance, error)

	// GetSyntheticReportFunc mocks the GetSyntheticReport method.
	GetSyntheticReportFunc func(contextMoqParam context.Context, account vos.Account, n int, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (*vos.SyntheticReport, error)

	// ListAccountEntriesFunc mocks the ListAccountEntries method.
	ListAccountEntriesFunc func(contextMoqParam context.Context, accountEntryRequest vos.AccountEntryRequest) (vos.AccountEntryResponse, error)
	// contains filtered or unexported fields
}

UseCaseMock is a mock implementation of domain.UseCase.

func TestSomethingThatUsesUseCase(t *testing.T) {

	// make and configure a mocked domain.UseCase
	mockedUseCase := &UseCaseMock{
		CreateTransactionFunc: func(contextMoqParam context.Context, transaction entities.Transaction) error {
			panic("mock out the CreateTransaction method")
		},
		GetAccountBalanceFunc: func(contextMoqParam context.Context, getAccountBalanceInput domain.GetAccountBalanceInput) (vos.AccountBalance, error) {
			panic("mock out the GetAccountBalance method")
		},
		GetSyntheticReportFunc: func(contextMoqParam context.Context, account vos.Account, n int, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (*vos.SyntheticReport, error) {
			panic("mock out the GetSyntheticReport method")
		},
		ListAccountEntriesFunc: func(contextMoqParam context.Context, accountEntryRequest vos.AccountEntryRequest) (vos.AccountEntryResponse, error) {
			panic("mock out the ListAccountEntries method")
		},
	}

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

}

func (*UseCaseMock) CreateTransaction

func (mock *UseCaseMock) CreateTransaction(contextMoqParam context.Context, transaction entities.Transaction) error

CreateTransaction calls CreateTransactionFunc.

func (*UseCaseMock) CreateTransactionCalls

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

CreateTransactionCalls gets all the calls that were made to CreateTransaction. Check the length with:

len(mockedUseCase.CreateTransactionCalls())

func (*UseCaseMock) GetAccountBalance

func (mock *UseCaseMock) GetAccountBalance(contextMoqParam context.Context, getAccountBalanceInput domain.GetAccountBalanceInput) (vos.AccountBalance, error)

GetAccountBalance calls GetAccountBalanceFunc.

func (*UseCaseMock) GetAccountBalanceCalls

func (mock *UseCaseMock) GetAccountBalanceCalls() []struct {
	ContextMoqParam        context.Context
	GetAccountBalanceInput domain.GetAccountBalanceInput
}

GetAccountBalanceCalls gets all the calls that were made to GetAccountBalance. Check the length with:

len(mockedUseCase.GetAccountBalanceCalls())

func (*UseCaseMock) GetSyntheticReport added in v0.5.0

func (mock *UseCaseMock) GetSyntheticReport(contextMoqParam context.Context, account vos.Account, n int, timeMoqParam1 time.Time, timeMoqParam2 time.Time) (*vos.SyntheticReport, error)

GetSyntheticReport calls GetSyntheticReportFunc.

func (*UseCaseMock) GetSyntheticReportCalls added in v0.5.0

func (mock *UseCaseMock) GetSyntheticReportCalls() []struct {
	ContextMoqParam context.Context
	Account         vos.Account
	N               int
	TimeMoqParam1   time.Time
	TimeMoqParam2   time.Time
}

GetSyntheticReportCalls gets all the calls that were made to GetSyntheticReport. Check the length with:

len(mockedUseCase.GetSyntheticReportCalls())

func (*UseCaseMock) ListAccountEntries added in v0.5.0

func (mock *UseCaseMock) ListAccountEntries(contextMoqParam context.Context, accountEntryRequest vos.AccountEntryRequest) (vos.AccountEntryResponse, error)

ListAccountEntries calls ListAccountEntriesFunc.

func (*UseCaseMock) ListAccountEntriesCalls added in v0.5.0

func (mock *UseCaseMock) ListAccountEntriesCalls() []struct {
	ContextMoqParam     context.Context
	AccountEntryRequest vos.AccountEntryRequest
}

ListAccountEntriesCalls gets all the calls that were made to ListAccountEntries. Check the length with:

len(mockedUseCase.ListAccountEntriesCalls())

Jump to

Keyboard shortcuts

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