Skip to main content

armature_testing/
test_container.rs

1// Test Container for Dependency Injection
2
3use armature_core::{Container, Provider};
4
5/// Test container with enhanced testing capabilities
6pub struct TestContainer {
7    container: Container,
8}
9
10impl TestContainer {
11    /// Create a new test container
12    pub fn new() -> Self {
13        Self {
14            container: Container::new(),
15        }
16    }
17
18    /// Register a provider
19    pub fn register<T: Provider + Clone + 'static>(&self, provider: T) {
20        self.container.register(provider);
21    }
22
23    /// Register a mock provider
24    pub fn register_mock<T: Provider + Clone + 'static>(&self, mock: T) {
25        self.container.register(mock);
26    }
27
28    /// Get a provider from the container
29    pub fn get<T: Provider + Clone + 'static>(&self) -> Option<T> {
30        // This would need actual container implementation
31        None
32    }
33
34    /// Clear all providers
35    pub fn clear(&mut self) {
36        self.container = Container::new();
37    }
38
39    /// Get the underlying container
40    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}