Module mock

Module mock 

Source
Expand description

Mocking support for Dash SDK.

This module provides a way to mock SDK operations. It is used in tests and examples.

In order to mock SDK operations, you need to create a mock SDK instance using Sdk::new_mock(). Next step is to create mock query expectations on MockDashPlatformSdk object returned by Sdk::mock(), using MockDashPlatformSdk::expect_fetch() and MockDashPlatformSdk::expect_fetch_many().

§Example

let mut sdk = dash_sdk::Sdk::new_mock();
let query = dash_sdk::platform::Identifier::random();
sdk.mock().expect_fetch(query, None as Option<dash_sdk::platform::Identity>);

See tests/fetch/mock_fetch.rs and tests/fetch/mock_fetch_many.rs for more detailed examples.

Re-exports§

pub use sdk::MockDashPlatformSdk;

Modules§

provider
Example ContextProvider that uses the Core RPC API and the Sdk to fetch data.
sdk
Mocking mechanisms for Dash Platform SDK.

Traits§

MockResponse
Trait implemented by objects that can be used in mock expectation responses.
Mockable
Mocking support for messages.