test

package
v2.0.0-preview6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockReceiverClient

func NewMockReceiverClient(t *testing.T, chanSize int, opts ...client.Option) (client.Client, chan<- event.Event)

MockReceiverClient returns a client that can Receive events, without replying. The returned channel is the channel for sending messages to the client

func NewMockRequesterClient

func NewMockRequesterClient(t *testing.T, chanSize int, replierFn func(inMessage event.Event) (*event.Event, error), opts ...client.Option) (client.Client, <-chan event.Event)

MockRequesterClient returns a client that can perform Send() event and Request() event. All sent messages are delivered to the returned channel.

func NewMockResponderClient

func NewMockResponderClient(t *testing.T, chanSize int, opts ...client.Option) (client.Client, chan<- event.Event, <-chan ClientMockResponse)

MockReceiverClient returns a client that can Receive events and reply. The first returned channel is the channel for sending messages to the client, while the second one contains the eventual responses.

func NewMockSenderClient

func NewMockSenderClient(t *testing.T, chanSize int, opts ...client.Option) (client.Client, <-chan event.Event)

MockSenderClient returns a client that can Send() event. All sent messages are delivered to the returned channel.

func SendReceive

func SendReceive(t *testing.T, protocolFactory func() interface{}, in event.Event, outAssert func(e event.Event), opts ...client.Option)

SendReceive does client.Send(in), then it receives the message using client.StartReceiver() and executes outAssert Halt test on error.

Types

type ClientMockResponse

type ClientMockResponse struct {
	Event  event.Event
	Result protocol.Result
}

Jump to

Keyboard shortcuts

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