pub struct TestFactory<M: ModuleDefinition> { /* private fields */ }Expand description
TestFactory
A factory for creating test instances of NestForge modules. Provides a convenient way to set up modules for testing with provider overrides.
§Type Parameters
M: The module type to create a test instance for
§Example
let module = TestFactory::<AppModule>::create()
.override_provider(MyService::mock())
.build()
.unwrap();Implementations§
Source§impl<M: ModuleDefinition> TestFactory<M>
impl<M: ModuleDefinition> TestFactory<M>
Sourcepub fn override_provider<T>(self, value: T) -> Self
pub fn override_provider<T>(self, value: T) -> Self
Sourcepub fn build(self) -> Result<TestingModule>
pub fn build(self) -> Result<TestingModule>
Builds the TestingModule with all configured overrides.
Auto Trait Implementations§
impl<M> Freeze for TestFactory<M>
impl<M> !RefUnwindSafe for TestFactory<M>
impl<M> Send for TestFactory<M>
impl<M> Sync for TestFactory<M>
impl<M> Unpin for TestFactory<M>where
M: Unpin,
impl<M> UnsafeUnpin for TestFactory<M>
impl<M> !UnwindSafe for TestFactory<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoInjectableResult<T> for T
impl<T> IntoInjectableResult<T> for T
fn into_injectable_result(self) -> Result<T, Error>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request