Documentation
¶
Overview ¶
Package mocks requires the github.com/matryer/moq lib to be installed.
Index ¶
- type ThingReaderWriterMock
- func (mock *ThingReaderWriterMock) Create(ctx context.Context, args backbone.ThingCreate) (*backbone.Thing, error)
- func (mock *ThingReaderWriterMock) CreateCalls() []struct{ ... }
- func (mock *ThingReaderWriterMock) Delete(ctx context.Context, args backbone.ThingArgs) error
- func (mock *ThingReaderWriterMock) DeleteCalls() []struct{ ... }
- func (mock *ThingReaderWriterMock) Thing(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error)
- func (mock *ThingReaderWriterMock) ThingCalls() []struct{ ... }
- func (mock *ThingReaderWriterMock) Things(ctx context.Context) ([]*backbone.Thing, error)
- func (mock *ThingReaderWriterMock) ThingsCalls() []struct{ ... }
- func (mock *ThingReaderWriterMock) Update(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error)
- func (mock *ThingReaderWriterMock) UpdateCalls() []struct{ ... }
- type ThingServiceMock
- func (mock *ThingServiceMock) Create(ctx context.Context, req backbone.ThingCreate) (*backbone.Thing, error)
- func (mock *ThingServiceMock) CreateCalls() []struct{ ... }
- func (mock *ThingServiceMock) Delete(ctx context.Context, args backbone.ThingArgs) error
- func (mock *ThingServiceMock) DeleteCalls() []struct{ ... }
- func (mock *ThingServiceMock) Thing(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error)
- func (mock *ThingServiceMock) ThingCalls() []struct{ ... }
- func (mock *ThingServiceMock) Things(ctx context.Context) ([]*backbone.Thing, error)
- func (mock *ThingServiceMock) ThingsCalls() []struct{ ... }
- func (mock *ThingServiceMock) Update(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error)
- func (mock *ThingServiceMock) UpdateCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ThingReaderWriterMock ¶
type ThingReaderWriterMock struct { // CreateFunc mocks the Create method. CreateFunc func(ctx context.Context, args backbone.ThingCreate) (*backbone.Thing, error) // DeleteFunc mocks the Delete method. DeleteFunc func(ctx context.Context, args backbone.ThingArgs) error // ThingFunc mocks the Thing method. ThingFunc func(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error) // ThingsFunc mocks the Things method. ThingsFunc func(ctx context.Context) ([]*backbone.Thing, error) // UpdateFunc mocks the Update method. UpdateFunc func(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error) // contains filtered or unexported fields }
ThingReaderWriterMock is a mock implementation of ThingReaderWriter.
func TestSomethingThatUsesThingReaderWriter(t *testing.T) { // make and configure a mocked ThingReaderWriter mockedThingReaderWriter := &ThingReaderWriterMock{ CreateFunc: func(ctx context.Context, args backbone.ThingCreate) (*backbone.Thing, error) { panic("mock out the Create method") }, DeleteFunc: func(ctx context.Context, args backbone.ThingArgs) error { panic("mock out the Delete method") }, ThingFunc: func(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error) { panic("mock out the Thing method") }, ThingsFunc: func(ctx context.Context) ([]*backbone.Thing, error) { panic("mock out the Things method") }, UpdateFunc: func(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error) { panic("mock out the Update method") }, } // use mockedThingReaderWriter in code that requires ThingReaderWriter // and then make assertions. }
func (*ThingReaderWriterMock) Create ¶
func (mock *ThingReaderWriterMock) Create(ctx context.Context, args backbone.ThingCreate) (*backbone.Thing, error)
Create calls CreateFunc.
func (*ThingReaderWriterMock) CreateCalls ¶
func (mock *ThingReaderWriterMock) CreateCalls() []struct { Ctx context.Context Args backbone.ThingCreate }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedThingReaderWriter.CreateCalls())
func (*ThingReaderWriterMock) DeleteCalls ¶
func (mock *ThingReaderWriterMock) DeleteCalls() []struct { Ctx context.Context Args backbone.ThingArgs }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedThingReaderWriter.DeleteCalls())
func (*ThingReaderWriterMock) Thing ¶
func (mock *ThingReaderWriterMock) Thing(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error)
Thing calls ThingFunc.
func (*ThingReaderWriterMock) ThingCalls ¶
func (mock *ThingReaderWriterMock) ThingCalls() []struct { Ctx context.Context Args backbone.ThingArgs }
ThingCalls gets all the calls that were made to Thing. Check the length with:
len(mockedThingReaderWriter.ThingCalls())
func (*ThingReaderWriterMock) ThingsCalls ¶
func (mock *ThingReaderWriterMock) ThingsCalls() []struct { Ctx context.Context }
ThingsCalls gets all the calls that were made to Things. Check the length with:
len(mockedThingReaderWriter.ThingsCalls())
func (*ThingReaderWriterMock) Update ¶
func (mock *ThingReaderWriterMock) Update(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error)
Update calls UpdateFunc.
func (*ThingReaderWriterMock) UpdateCalls ¶
func (mock *ThingReaderWriterMock) UpdateCalls() []struct { Ctx context.Context Args backbone.ThingArgs Req backbone.ThingUpdate }
UpdateCalls gets all the calls that were made to Update. Check the length with:
len(mockedThingReaderWriter.UpdateCalls())
type ThingServiceMock ¶
type ThingServiceMock struct { // CreateFunc mocks the Create method. CreateFunc func(ctx context.Context, req backbone.ThingCreate) (*backbone.Thing, error) // DeleteFunc mocks the Delete method. DeleteFunc func(ctx context.Context, args backbone.ThingArgs) error // ThingFunc mocks the Thing method. ThingFunc func(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error) // ThingsFunc mocks the Things method. ThingsFunc func(ctx context.Context) ([]*backbone.Thing, error) // UpdateFunc mocks the Update method. UpdateFunc func(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error) // contains filtered or unexported fields }
ThingServiceMock is a mock implementation of ThingService.
func TestSomethingThatUsesThingService(t *testing.T) { // make and configure a mocked ThingService mockedThingService := &ThingServiceMock{ CreateFunc: func(ctx context.Context, req backbone.ThingCreate) (*backbone.Thing, error) { panic("mock out the Create method") }, DeleteFunc: func(ctx context.Context, args backbone.ThingArgs) error { panic("mock out the Delete method") }, ThingFunc: func(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error) { panic("mock out the Thing method") }, ThingsFunc: func(ctx context.Context) ([]*backbone.Thing, error) { panic("mock out the Things method") }, UpdateFunc: func(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error) { panic("mock out the Update method") }, } // use mockedThingService in code that requires ThingService // and then make assertions. }
func (*ThingServiceMock) Create ¶
func (mock *ThingServiceMock) Create(ctx context.Context, req backbone.ThingCreate) (*backbone.Thing, error)
Create calls CreateFunc.
func (*ThingServiceMock) CreateCalls ¶
func (mock *ThingServiceMock) CreateCalls() []struct { Ctx context.Context Req backbone.ThingCreate }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedThingService.CreateCalls())
func (*ThingServiceMock) DeleteCalls ¶
func (mock *ThingServiceMock) DeleteCalls() []struct { Ctx context.Context Args backbone.ThingArgs }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedThingService.DeleteCalls())
func (*ThingServiceMock) Thing ¶
func (mock *ThingServiceMock) Thing(ctx context.Context, args backbone.ThingArgs) (*backbone.Thing, error)
Thing calls ThingFunc.
func (*ThingServiceMock) ThingCalls ¶
func (mock *ThingServiceMock) ThingCalls() []struct { Ctx context.Context Args backbone.ThingArgs }
ThingCalls gets all the calls that were made to Thing. Check the length with:
len(mockedThingService.ThingCalls())
func (*ThingServiceMock) ThingsCalls ¶
func (mock *ThingServiceMock) ThingsCalls() []struct { Ctx context.Context }
ThingsCalls gets all the calls that were made to Things. Check the length with:
len(mockedThingService.ThingsCalls())
func (*ThingServiceMock) Update ¶
func (mock *ThingServiceMock) Update(ctx context.Context, args backbone.ThingArgs, req backbone.ThingUpdate) (*backbone.Thing, error)
Update calls UpdateFunc.
func (*ThingServiceMock) UpdateCalls ¶
func (mock *ThingServiceMock) UpdateCalls() []struct { Ctx context.Context Args backbone.ThingArgs Req backbone.ThingUpdate }
UpdateCalls gets all the calls that were made to Update. Check the length with:
len(mockedThingService.UpdateCalls())