use crate::mock::Times;
#[derive(Clone)]
pub(crate) struct VerificationReport {
pub(crate) mock_name: Option<String>,
pub(crate) expectation_range: Times,
pub(crate) n_matched_requests: u64,
pub(crate) position_in_set: usize,
}
impl VerificationReport {
pub(crate) fn error_message(&self) -> String {
if let Some(ref mock_name) = self.mock_name {
format!(
"{}.\n\tExpected range of matching incoming requests: {}\n\tNumber of matched incoming requests: {}",
mock_name, self.expectation_range, self.n_matched_requests
)
} else {
format!(
"Mock #{}.\n\tExpected range of matching incoming requests: {}\n\tNumber of matched incoming requests: {}",
self.position_in_set, self.expectation_range, self.n_matched_requests
)
}
}
pub(crate) fn is_satisfied(&self) -> bool {
self.expectation_range.contains(self.n_matched_requests)
}
}
pub(crate) enum VerificationOutcome {
Success,
Failure(Vec<VerificationReport>),
}