pub async fn add_mocked_component(
        &self,
        moniker: Moniker,
        mock: mock::Mock,
    ) -> Result<(), Error> {
        let mock_id = self
            .framework_intermediary_proxy
            .new_mock_id()
            .await
            .map_err(RealmError::FailedToUseFrameworkIntermediary)?;
        self.mocks_runner.register_mock(mock_id.clone(), mock).await;
        let decl = cm_rust::ComponentDecl {
            program: Some(cm_rust::ProgramDecl {
                runner: Some(mock::RUNNER_NAME.try_into().unwrap()),
                info: fdata::Dictionary {
                    entries: Some(vec![fdata::DictionaryEntry {
                        key: mock::MOCK_ID_KEY.to_string(),
                        value: Some(Box::new(fdata::DictionaryValue::Str(mock_id))),
                    }]),
                    ..fdata::Dictionary::EMPTY
                },
            }),
            ..cm_rust::ComponentDecl::default()
        };
        self.set_component(&moniker, decl).await
    }
/// Adds a new mocked component to the realm. When the component is supposed to run the
/// provided [`Mock`] is called with the component's handles.
Adds a new mocked component to the realm. When the component is supposed to run the
provided [`Mock`] is called with the component's handles.
Adds a new mocked component to the realm . When the component is supposed to run the provided [ ` Mock ` ] is called with the component ' s handles .
pub async fn add_mocked_component(
        &self,
        moniker: Moniker,
        mock: mock::Mock,
    ) -> Result<(), Error> {
        let mock_id = self
            .framework_intermediary_proxy
            .new_mock_id()
            .await
            .map_err(RealmError::FailedToUseFrameworkIntermediary)?;
        self.mocks_runner.register_mock(mock_id.clone(), mock).await;
        let decl = cm_rust::ComponentDecl {
            program: Some(cm_rust::ProgramDecl {
                runner: Some(mock::RUNNER_NAME.try_into().unwrap()),
                info: fdata::Dictionary {
                    entries: Some(vec![fdata::DictionaryEntry {
                        key: mock::MOCK_ID_KEY.to_string(),
                        value: Some(Box::new(fdata::DictionaryValue::Str(mock_id))),
                    }]),
                    ..fdata::Dictionary::EMPTY
                },
            }),
            ..cm_rust::ComponentDecl::default()
        };
        self.set_component(&moniker, decl).await
    }
pub async fn add_mocked_component ( & self , moniker : Moniker , mock : mock :: Mock , ) -> Result < ( ) , Error > { let mock_id = self . framework_intermediary_proxy . new_mock_id ( ) . await . map_err ( RealmError :: FailedToUseFrameworkIntermediary ) ? ; self . mocks_runner . register_mock ( mock_id . clone ( ) , mock ) . await ; let decl = cm_rust :: ComponentDecl { program : Some ( cm_rust :: ProgramDecl { runner : Some ( mock :: RUNNER_NAME . try_into ( ) . unwrap ( ) ) , info : fdata :: Dictionary { entries : Some ( vec ! [ fdata DictionaryEntry { key mock MOCK_ID_KEY to_string ( ) value Some ( Box new ( fdata DictionaryValue Str ( mock_id ) ) ) } ] ) , .. fdata :: Dictionary :: EMPTY } , } ) , .. cm_rust :: ComponentDecl :: default ( ) } ; self . set_component ( & moniker , decl ) . await }
Adds a new mocked component to the realm.
Adds a new mocked component to the realm .
&self
moniker
Moniker
mock
mock::Mock
&self
moniker
Moniker
mock
mock::Mock