Struct eventually::aggregate::test::Scenario
source · pub struct Scenario<T>(/* private fields */)
where
T: Aggregate,
T::Id: Clone,
T::Event: Debug + PartialEq,
T::Error: Debug;
Expand description
A test scenario that can be used to test an Aggregate and Aggregate Root using a given-then-when canvas approach.
Implementations§
source§impl<T> Scenario<T>
impl<T> Scenario<T>
sourcepub fn given(self, events: Vec<Envelope<T::Event>>) -> ScenarioGiven<T>
pub fn given(self, events: Vec<Envelope<T::Event>>) -> ScenarioGiven<T>
Specifies the precondition for the test Scenario.
In other words, it can be used to specify all the Domain Events that make up the state of the Aggregate Root.
sourcepub fn when<R, F, Err>(self, f: F) -> ScenarioWhen<T, R, F, Err>
pub fn when<R, F, Err>(self, f: F) -> ScenarioWhen<T, R, F, Err>
Specifies the action/mutation to execute in this Scenario.
Use this branch when testing actions/mutations that create new Aggregate Root instances, i.e. with no prior Domain Events recorded.
Trait Implementations§
impl<T> Copy for Scenario<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Scenario<T>where
T: RefUnwindSafe,
impl<T> Send for Scenario<T>
impl<T> Sync for Scenario<T>
impl<T> Unpin for Scenario<T>where
T: Unpin,
impl<T> UnwindSafe for Scenario<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more