use super::*;
#[derive(Debug, Default, PartialEq, Eq, Clone)]
pub struct Event {
pub(super) inner: InnerComponent,
}
impl Event {
pub fn new() -> Self {
Default::default()
}
pub fn done(&mut self) -> Self {
Event {
inner: self.inner.done(),
}
}
pub fn status(&mut self, status: EventStatus) -> &mut Self {
self.append_property(status)
}
pub fn get_status(&self) -> Option<EventStatus> {
EventStatus::from_str(self.property_value("STATUS")?)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn get_properties_unset() {
let event = Event::new();
assert_eq!(event.get_status(), None);
}
#[test]
fn get_properties_set() {
let event = Event::new().status(EventStatus::Tentative).done();
assert_eq!(event.get_status(), Some(EventStatus::Tentative));
}
}