/// Returns a `Model` and `BuiltinEnvironment` suitable for most tests.
Returns a `Model` and `BuiltinEnvironment` suitable for most tests.
Returns a ` Model ` and ` BuiltinEnvironment ` suitable for most tests .
pub async fn build(mut self) -> TestModelResult {
        let mock_runner = Arc::new(MockRunner::new());
        let mut mock_resolver = MockResolver::new();
        for (name, decl) in &self.components {
            mock_resolver.add_component(name, decl.clone());
        }
        self.runtime_config.root_component_url =
            Some(Url::new(format!("test:///{}", self.root_component)).unwrap());
        let builtin_environment = Arc::new(Mutex::new(
            BuiltinEnvironmentBuilder::new()
                .add_resolver("test".to_string(), Box::new(mock_resolver))
                .add_runner(TEST_RUNNER_NAME.into(), mock_runner.clone())
                .set_runtime_config(self.runtime_config)
                .enable_hub(self.enable_hub)
                .build()
                .await
                .expect("builtin environment setup failed"),
        ));
        let model = builtin_environment.lock().await.model.clone();
        TestModelResult { model, builtin_environment, mock_runner }
    }
pub async fn build ( mut self ) -> TestModelResult { let mock_runner = Arc :: new ( MockRunner :: new ( ) ) ; let mut mock_resolver = MockResolver :: new ( ) ; for ( name , decl ) in & self . components { mock_resolver . add_component ( name , decl . clone ( ) ) ; } self . runtime_config . root_component_url = Some ( Url :: new ( format ! ( " " self root_component ) ) . unwrap ( ) ) ; let builtin_environment = Arc :: new ( Mutex :: new ( BuiltinEnvironmentBuilder :: new ( ) . add_resolver ( " " . to_string ( ) , Box :: new ( mock_resolver ) ) . add_runner ( TEST_RUNNER_NAME . into ( ) , mock_runner . clone ( ) ) . set_runtime_config ( self . runtime_config ) . enable_hub ( self . enable_hub ) . build ( ) . await . expect ( " " ) , ) ) ; let model = builtin_environment . lock ( ) . await . model . clone ( ) ; TestModelResult { model , builtin_environment , mock_runner } }
Returns a `Model` and `BuiltinEnvironment` suitable for most tests.
Returns a ` Model ` and ` BuiltinEnvironment ` suitable for most tests .
mut self