testdsl

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker func(err error)

Checker asserts the given results.

type DispatcherTester

type DispatcherTester func(given GivenFn, when WhenFn, then ThenFn)

DispatcherTester defines a query runner tester.

func Test

func Test(t testing.TB) DispatcherTester

Test runs the test.

Example:

commandHandler := &mock.ConcreteCommandHandlerStub{}

Test(t)(
	Given("TestCommand", commandHandler.Handle),
	When(context.Background(), mock.TestCommand{}),
	ThenOk(),
)

type GivenFn

type GivenFn func() (cmdhandler.CommandHandler, error)

GivenFn is a test init function.

func Given

func Given(commandType string, concreteCommandHandler interface{}) GivenFn

Given prepares the given command handler for testing.

type ThenFn

type ThenFn func(t testing.TB) Checker

ThenFn prepares the Checker.

func ThenFailWith

func ThenFailWith(want error) ThenFn

ThenFailWith asserts that the expected error occurred.

func ThenOk

func ThenOk() ThenFn

Then asserts that the expected events are applied.

type WhenFn

type WhenFn func(commandHandler cmdhandler.CommandHandler, err error) error

WhenFn is a command handler function.

func When

func When(ctx context.Context, c interface{}) WhenFn

When prepares the command handler for the given command.

Jump to

Keyboard shortcuts

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