customer

package
v0.0.0-...-2ccb8c0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	AddCustomer(ctx context.Context, req mCustomer.AddCustomerRequest) (lastID int64, err error)
	UpdateCustomer(ctx context.Context, cifId int64, req mCustomer.AddCustomerRequest) (err error)
	FetchByCifId(ctx context.Context, cifId int64) (count int64, err error)
	FetchCustomerByCifId(ctx context.Context, cifId int64) (data mCustomer.AddCustomerRequest, err error)
}

Repository : function contract for customer

type RepositoryMock

type RepositoryMock struct {
	// AddCustomerFunc mocks the AddCustomer method.
	AddCustomerFunc func(ctx context.Context, req mCustomer.AddCustomerRequest) (int64, error)

	// FetchByCifIdFunc mocks the FetchByCifId method.
	FetchByCifIdFunc func(ctx context.Context, cifId int64) (int64, error)

	// FetchCustomerByCifIdFunc mocks the FetchCustomerByCifId method.
	FetchCustomerByCifIdFunc func(ctx context.Context, cifId int64) (mCustomer.AddCustomerRequest, error)

	// UpdateCustomerFunc mocks the UpdateCustomer method.
	UpdateCustomerFunc func(ctx context.Context, cifId int64, req mCustomer.AddCustomerRequest) 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{
		AddCustomerFunc: func(ctx context.Context, req mCustomer.AddCustomerRequest) (int64, error) {
			panic("mock out the AddCustomer method")
		},
		FetchByCifIdFunc: func(ctx context.Context, cifId int64) (int64, error) {
			panic("mock out the FetchByCifId method")
		},
		FetchCustomerByCifIdFunc: func(ctx context.Context, cifId int64) (mCustomer.AddCustomerRequest, error) {
			panic("mock out the FetchCustomerByCifId method")
		},
		UpdateCustomerFunc: func(ctx context.Context, cifId int64, req mCustomer.AddCustomerRequest) error {
			panic("mock out the UpdateCustomer method")
		},
	}

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

}

func (*RepositoryMock) AddCustomer

func (mock *RepositoryMock) AddCustomer(ctx context.Context, req mCustomer.AddCustomerRequest) (int64, error)

AddCustomer calls AddCustomerFunc.

func (*RepositoryMock) AddCustomerCalls

func (mock *RepositoryMock) AddCustomerCalls() []struct {
	Ctx context.Context
	Req mCustomer.AddCustomerRequest
}

AddCustomerCalls gets all the calls that were made to AddCustomer. Check the length with:

len(mockedRepository.AddCustomerCalls())

func (*RepositoryMock) FetchByCifId

func (mock *RepositoryMock) FetchByCifId(ctx context.Context, cifId int64) (int64, error)

FetchByCifId calls FetchByCifIdFunc.

func (*RepositoryMock) FetchByCifIdCalls

func (mock *RepositoryMock) FetchByCifIdCalls() []struct {
	Ctx   context.Context
	CifId int64
}

FetchByCifIdCalls gets all the calls that were made to FetchByCifId. Check the length with:

len(mockedRepository.FetchByCifIdCalls())

func (*RepositoryMock) FetchCustomerByCifId

func (mock *RepositoryMock) FetchCustomerByCifId(ctx context.Context, cifId int64) (mCustomer.AddCustomerRequest, error)

FetchCustomerByCifId calls FetchCustomerByCifIdFunc.

func (*RepositoryMock) FetchCustomerByCifIdCalls

func (mock *RepositoryMock) FetchCustomerByCifIdCalls() []struct {
	Ctx   context.Context
	CifId int64
}

FetchCustomerByCifIdCalls gets all the calls that were made to FetchCustomerByCifId. Check the length with:

len(mockedRepository.FetchCustomerByCifIdCalls())

func (*RepositoryMock) UpdateCustomer

func (mock *RepositoryMock) UpdateCustomer(ctx context.Context, cifId int64, req mCustomer.AddCustomerRequest) error

UpdateCustomer calls UpdateCustomerFunc.

func (*RepositoryMock) UpdateCustomerCalls

func (mock *RepositoryMock) UpdateCustomerCalls() []struct {
	Ctx   context.Context
	CifId int64
	Req   mCustomer.AddCustomerRequest
}

UpdateCustomerCalls gets all the calls that were made to UpdateCustomer. Check the length with:

len(mockedRepository.UpdateCustomerCalls())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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