pub struct InMemoryCase<W: PureWorkflow> { /* private fields */ }Expand description
An ExecutorFactory over InMemoryExecutor, for any workflow whose
transitions are a pure function.
use turnframe_core::case::CaseRef;
use turnframe_core::ids::CaseRevision;
use turnframe_test::executors::{self, InMemoryCase};
use turnframe_test::workflows::trip::{
TripCommand, TripWorkflow, complete_case, sample_new_extra,
};
let case = InMemoryCase::<TripWorkflow>::new(
CaseRef::new("trip", "trip-conformance", CaseRevision(4)),
Some(complete_case()),
TripCommand::AddExtra { extra: sample_new_extra(1) },
TripCommand::SetName { value: "Another name".to_owned() },
TripCommand::Rebook,
);
let report = executors::run_all(&case).await;
assert!(report.passed(), "{report}");Implementations§
Source§impl<W: PureWorkflow> InMemoryCase<W>
impl<W: PureWorkflow> InMemoryCase<W>
Sourcepub fn new(
case_ref: CaseRef,
seed_state: Option<W::State>,
first: W::Command,
second: W::Command,
refused: W::Command,
) -> Self
pub fn new( case_ref: CaseRef, seed_state: Option<W::State>, first: W::Command, second: W::Command, refused: W::Command, ) -> Self
Describes a case and the three commands the suite drives it with.
seed_state is the state the case starts from, installed at
case_ref.expected_revision; None means the case does not exist yet,
in which case the revision must be
CaseRevision::ZERO and
first must be the command that brings it into existence.
See SeededCase for what the three commands have to satisfy — in
particular that first must not be naturally idempotent.
Trait Implementations§
Source§impl<W: PureWorkflow> Debug for InMemoryCase<W>
impl<W: PureWorkflow> Debug for InMemoryCase<W>
Source§impl<W> ExecutorFactory for InMemoryCase<W>where
W: PureWorkflow + Default,
impl<W> ExecutorFactory for InMemoryCase<W>where
W: PureWorkflow + Default,
Source§type Executor = InMemoryExecutor<W>
type Executor = InMemoryExecutor<W>
The executor implementation being proven.
Source§fn seed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SeedOf<Self>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn seed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SeedOf<Self>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Builds a fresh executor and seeds one case in it. Read more
Source§fn interrupt_after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
seeded: &'life1 SeedOf<Self>,
batch: &'life2 BatchOf<Self>,
applied: usize,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn interrupt_after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
seeded: &'life1 SeedOf<Self>,
batch: &'life2 BatchOf<Self>,
applied: usize,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Commits only the first
applied envelopes of batch, as a process that
died mid-batch would have left them. Read moreAuto Trait Implementations§
impl<W> Freeze for InMemoryCase<W>
impl<W> RefUnwindSafe for InMemoryCase<W>where
Option<<W as WorkflowDefinition>::State>: RefUnwindSafe,
<W as WorkflowDefinition>::Command: RefUnwindSafe,
impl<W> Send for InMemoryCase<W>
impl<W> Sync for InMemoryCase<W>
impl<W> Unpin for InMemoryCase<W>
impl<W> UnsafeUnpin for InMemoryCase<W>where
Option<<W as WorkflowDefinition>::State>: UnsafeUnpin,
<W as WorkflowDefinition>::Command: UnsafeUnpin,
impl<W> UnwindSafe for InMemoryCase<W>where
Option<<W as WorkflowDefinition>::State>: UnwindSafe,
<W as WorkflowDefinition>::Command: 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