EffectAssertions

Trait EffectAssertions 

Source
pub trait EffectAssertions<E> {
    // Required methods
    fn effects_empty(&self);
    fn effects_not_empty(&self);
    fn effects_count(&self, n: usize);
    fn effects_any_matches<F: Fn(&E) -> bool>(&self, f: F);
    fn effects_first_matches<F: Fn(&E) -> bool>(&self, f: F);
    fn effects_all_match<F: Fn(&E) -> bool>(&self, f: F);
    fn effects_none_match<F: Fn(&E) -> bool>(&self, f: F);
}
Expand description

Fluent assertions for effect vectors.

Method names are prefixed with effects_ to avoid conflicts with ActionAssertions when both traits are in scope.

§Example

use tui_dispatch::testing::EffectAssertions;

let effects = harness.drain_effects();
effects.effects_count(1);
effects.effects_first_matches(|e| matches!(e, Effect::FetchWeather { .. }));

Required Methods§

Source

fn effects_empty(&self)

Assert the effect vector is empty.

Source

fn effects_not_empty(&self)

Assert the effect vector is not empty.

Source

fn effects_count(&self, n: usize)

Assert the effect vector has exactly n elements.

Source

fn effects_any_matches<F: Fn(&E) -> bool>(&self, f: F)

Assert any effect matches the predicate.

Source

fn effects_first_matches<F: Fn(&E) -> bool>(&self, f: F)

Assert the first effect matches the predicate.

Source

fn effects_all_match<F: Fn(&E) -> bool>(&self, f: F)

Assert all effects match the predicate.

Source

fn effects_none_match<F: Fn(&E) -> bool>(&self, f: F)

Assert no effects match the predicate.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<E: Debug> EffectAssertions<E> for Vec<E>

Source§

fn effects_empty(&self)

Source§

fn effects_not_empty(&self)

Source§

fn effects_count(&self, n: usize)

Source§

fn effects_any_matches<F: Fn(&E) -> bool>(&self, f: F)

Source§

fn effects_first_matches<F: Fn(&E) -> bool>(&self, f: F)

Source§

fn effects_all_match<F: Fn(&E) -> bool>(&self, f: F)

Source§

fn effects_none_match<F: Fn(&E) -> bool>(&self, f: F)

Implementors§