pub struct Expectations { /* private fields */ }Implementations§
Source§impl Expectations
impl Expectations
Sourcepub fn new() -> Expectations
pub fn new() -> Expectations
Create a new Expectations instance. Call this when your mock object is created.
Sourcepub fn expect<I, O>(&mut self, name: &'static str) -> Method<'_, I, O>where
I: 'static,
O: 'static,
pub fn expect<I, O>(&mut self, name: &'static str) -> Method<'_, I, O>where
I: 'static,
O: 'static,
Returns a Method struct which you can use to add expectations for the
method with the given name.
Sourcepub fn then(&mut self) -> &mut Expectations
pub fn then(&mut self) -> &mut Expectations
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.
Sourcepub fn was_called<I, O>(&self, name: &'static str, params: I)where
I: 'static,
O: 'static,
pub fn was_called<I, O>(&self, name: &'static str, params: I)where
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.
Sourcepub fn was_called_returning<I, O>(&self, name: &'static str, params: I) -> Owhere
I: 'static,
O: 'static,
pub fn was_called_returning<I, O>(&self, name: &'static str, params: I) -> Owhere
I: 'static,
O: 'static,
Same as the was_called method, but also returns the result.