Struct DeciderTestSpecification

Source
pub struct DeciderTestSpecification<'a, Command, State, Event, Error>
where Event: PartialEq + Debug, Error: PartialEq + Debug,
{ /* private fields */ }
Expand description

A test specification DSL for deciders that supports the given-when-then format. The DSL is used to specify the events that have already occurred (GIVEN), the command that is being executed (WHEN), and the expected events (THEN) that should be generated.

Implementations§

Source§

impl<'a, Command, State, Event, Error> DeciderTestSpecification<'a, Command, State, Event, Error>
where Event: PartialEq + Debug, State: PartialEq + Debug, Error: PartialEq + Debug,

Source

pub fn for_decider( self, decider: Decider<'a, Command, State, Event, Error>, ) -> Self

Specify the decider you want to test

Source

pub fn given(self, events: Vec<Event>) -> Self

Given preconditions / previous events

Source

pub fn given_state(self, state: Option<State>) -> Self

Given preconditions / previous state

Source

pub fn when(self, command: Command) -> Self

When action/command

Source

pub fn then(self, expected_events: Vec<Event>)

Then expect result / new events

Source

pub fn then_state(self, expected_state: State)

Then expect result / new events

Source

pub fn then_error(self, expected_error: Error)

Then expect error result / these are not events

Trait Implementations§

Source§

impl<Command, State, Event, Error> Default for DeciderTestSpecification<'_, Command, State, Event, Error>
where Event: PartialEq + Debug, Error: PartialEq + Debug,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, Command, State, Event, Error> Freeze for DeciderTestSpecification<'a, Command, State, Event, Error>
where State: Freeze, Command: Freeze,

§

impl<'a, Command, State, Event, Error> !RefUnwindSafe for DeciderTestSpecification<'a, Command, State, Event, Error>

§

impl<'a, Command, State, Event, Error> Send for DeciderTestSpecification<'a, Command, State, Event, Error>
where State: Send, Command: Send, Event: Send,

§

impl<'a, Command, State, Event, Error> Sync for DeciderTestSpecification<'a, Command, State, Event, Error>
where State: Sync, Command: Sync, Event: Sync,

§

impl<'a, Command, State, Event, Error> Unpin for DeciderTestSpecification<'a, Command, State, Event, Error>
where State: Unpin, Command: Unpin, Event: Unpin,

§

impl<'a, Command, State, Event, Error> !UnwindSafe for DeciderTestSpecification<'a, Command, State, Event, Error>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.