Struct simulacrum_mock::mock::Expectations
[−]
[src]
pub struct Expectations { /* fields omitted */ }
Methods
impl Expectations
[src]
pub fn new() -> Self
[src]
Create a new Expectations
instance. Call this when your mock object is created.
pub fn expect<I, O>(&mut self, name: MethodName) -> Method<I, O> where
I: 'static,
O: 'static,
[src]
I: 'static,
O: 'static,
Returns a Method
struct which you can use to add expectations for the
method with the given name.
ⓘImportant traits for &'a mut Wpub fn then(&mut self) -> &mut Self
[src]
Begin a new Era. Expectations in one Era must be met before expectations in future eras will be evaluated.
Note that Eras are evaluated eagerly. This means that Eras may advance more
quickly than you'd intuitively expect in certain situations. For example,
called_any()
is marked as complete after the first call is received.
This menas that, for the purposes of telling if an Era should be advanced or
not, called_any()
and called_once()
are the same.
pub fn was_called<I, O>(&self, name: MethodName, params: I) where
I: 'static,
O: 'static,
[src]
I: 'static,
O: 'static,
When a tracked method is called on the mock object, call this with the method's name
in order to tell the Expectations
that the method was called.
Unlike was_called_returning
, this method does not return a value.
pub fn was_called_returning<I, O>(&self, name: MethodName, params: I) -> O where
I: 'static,
O: 'static,
[src]
I: 'static,
O: 'static,
Same as the was_called
method, but also returns the result.