Module dash_sdk::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/mock_*.rs for more detailed examples.

Re-exports§

Modules§

  • Example ContextProvider that uses the Core gRPC API to fetch data from Platform.
  • Mocking mechanisms for Dash Platform SDK.

Traits§

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