blob: 0089b9c5cc933e8a615ae048043f60016816cd7d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
use messages::Message;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NotUnderstood {
pub path: Vec<String>,
}
impl Message for NotUnderstood {
fn name(&self) -> String {
String::from("NOT_UNDERSTOOD")
}
}
impl PartialEq for NotUnderstood {
fn eq(&self, other: &Self) -> bool {
self.path == other.path
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_name() {
// Arrange
let message = NotUnderstood { path: vec![] };
// Act
let name = message.name();
// Assert
assert_eq!(name, "NOT_UNDERSTOOD");
}
#[test]
fn test_asoutgoing() {
// Arrange
let message = NotUnderstood { path: vec![] };
let message_ref = message.clone();
// Act
let outgoing = message.as_outgoing();
// Assert
assert_eq!(outgoing.result_type, "NOT_UNDERSTOOD");
assert_eq!(outgoing.content, message_ref);
}
}
|