-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
struct MyMock {
pub mock_do_stuff: Mock<(), i32>,
}
impl MyMock {
pub fn do_stuff(&self) -> i32 {
self.mock_do_stuff.call(())
}
}
impl Default for MyMock {
fn default() -> MyMock {
MyMock {
mock_do_stuff: Mock::new(10),
}
}
}
#[test]
pub fn playground() {
let mock = MyMock::default();
assert_eq!(mock.do_stuff(), 10);
mock.mock_do_stuff.return_value(42);
mock.mock_do_stuff.return_value(84);
let result1 = mock.do_stuff();
let result2 = mock.do_stuff();
assert_eq!(result1, 42); // returns 84; desire is it would return 42 on the first call and 84 on any remaining calls.
assert_eq!(result2, 84);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels