Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServerMock ¶
type ServerMock struct { // RegisterServiceFunc mocks the RegisterService method. RegisterServiceFunc func(sd *grpc2.ServiceDesc, ss interface{}) // contains filtered or unexported fields }
ServerMock is a mock implementation of grpc.Server.
func TestSomethingThatUsesServer(t *testing.T) { // make and configure a mocked grpc.Server mockedServer := &ServerMock{ RegisterServiceFunc: func(sd *grpc2.ServiceDesc, ss interface{}) { panic("mock out the RegisterService method") }, } // use mockedServer in code that requires grpc.Server // and then make assertions. }
func (*ServerMock) RegisterService ¶
func (mock *ServerMock) RegisterService(sd *grpc2.ServiceDesc, ss interface{})
RegisterService calls RegisterServiceFunc.
func (*ServerMock) RegisterServiceCalls ¶
func (mock *ServerMock) RegisterServiceCalls() []struct { Sd *grpc2.ServiceDesc Ss interface{} }
RegisterServiceCalls gets all the calls that were made to RegisterService. Check the length with:
len(mockedServer.RegisterServiceCalls())
Click to show internal directories.
Click to hide internal directories.