1use xso::{AsXml, FromXml};
8
9use crate::ns;
10
11#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
13#[xml(namespace = ns::CSI, name = "csi")]
14pub struct Feature;
15
16#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
18#[xml(namespace = ns::CSI, name = "inactive")]
19pub struct Inactive;
20
21#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
23#[xml(namespace = ns::CSI, name = "active")]
24pub struct Active;
25
26#[cfg(test)]
27mod tests {
28 use super::*;
29 use crate::ns;
30 use minidom::Element;
31
32 #[test]
33 fn test_size() {
34 assert_size!(Feature, 0);
35 assert_size!(Inactive, 0);
36 assert_size!(Active, 0);
37 }
38
39 #[test]
40 fn parsing() {
41 let elem: Element = "<csi xmlns='urn:xmpp:csi:0'/>".parse().unwrap();
42 Feature::try_from(elem).unwrap();
43
44 let elem: Element = "<inactive xmlns='urn:xmpp:csi:0'/>".parse().unwrap();
45 Inactive::try_from(elem).unwrap();
46
47 let elem: Element = "<active xmlns='urn:xmpp:csi:0'/>".parse().unwrap();
48 Active::try_from(elem).unwrap();
49 }
50
51 #[test]
52 fn serialising() {
53 let elem: Element = Feature.into();
54 assert!(elem.is("csi", ns::CSI));
55
56 let elem: Element = Inactive.into();
57 assert!(elem.is("inactive", ns::CSI));
58
59 let elem: Element = Active.into();
60 assert!(elem.is("active", ns::CSI));
61 }
62}