armature_testing/
test_container.rs1use armature_core::{Container, Provider};
4
5pub struct TestContainer {
7 container: Container,
8}
9
10impl TestContainer {
11 pub fn new() -> Self {
13 Self {
14 container: Container::new(),
15 }
16 }
17
18 pub fn register<T: Provider + Clone + 'static>(&self, provider: T) {
20 self.container.register(provider);
21 }
22
23 pub fn register_mock<T: Provider + Clone + 'static>(&self, mock: T) {
25 self.container.register(mock);
26 }
27
28 pub fn get<T: Provider + Clone + 'static>(&self) -> Option<T> {
30 None
32 }
33
34 pub fn clear(&mut self) {
36 self.container = Container::new();
37 }
38
39 pub fn inner(&self) -> &Container {
41 &self.container
42 }
43}
44
45impl Default for TestContainer {
46 fn default() -> Self {
47 Self::new()
48 }
49}
50
51#[cfg(test)]
52mod tests {
53 use super::*;
54
55 #[test]
56 fn test_container_creation() {
57 let _container = TestContainer::new();
58 }
59}