pub struct TestContext<'a, C> { /* private fields */ }
👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Expand description

Context used for testing. The type parameter C is used to determine whether this will be an init or receive context.

Implementations§

source§

impl<'a, C> TestContext<'a, C>

source

pub fn push_policy(&mut self, value: OwnedPolicy) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Push a new sender policy to the context. When the first policy is pushed this will set the policy vector to ‘Some’, even if it was undefined previously.

source

pub fn empty_policies(&mut self) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Set the policies to be defined, but an empty list. Such a situation can not realistically happen on the chain, but we provide functionality for it in case smart contract writers wish to program defensively.

source

pub fn set_parameter(&mut self, value: &'a [u8]) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
source

pub fn metadata_mut(&mut self) -> &mut TestChainMeta

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Get a mutable reference to the chain meta data placeholder

source

pub fn set_metadata_slot_time(&mut self, value: SlotTime) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Set the metadata block slot time

source§

impl<'a> TestContext<'a, TestInitOnlyData>

source

pub fn empty() -> Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Create an TestInitContext where every field is unset, and getting any of the fields will result in fail!.

source

pub fn set_init_origin(&mut self, value: AccountAddress) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Set init_origin in the TestInitContext

source§

impl<'a> TestContext<'a, TestReceiveOnlyData>

source

pub fn empty() -> Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Create a TestReceiveContext where every field is unset, and getting any of the fields will result in fail!.

source

pub fn set_invoker(&mut self, value: AccountAddress) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
source

pub fn set_self_address(&mut self, value: ContractAddress) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
source

pub fn set_sender(&mut self, value: Address) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
source

pub fn set_owner(&mut self, value: AccountAddress) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
source

pub fn set_named_entrypoint(&mut self, value: OwnedEntrypointName) -> &mut Self

👎Deprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Trait Implementations§

source§

impl<'a, C: Clone> Clone for TestContext<'a, C>

source§

fn clone(&self) -> TestContext<'a, C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, C: Default> Default for TestContext<'a, C>

source§

fn default() -> TestContext<'a, C>

Returns the “default value” for a type. Read more
source§

impl<'a, C> HasCommonData for TestContext<'a, C>

§

type MetadataType = TestChainMeta

§

type ParamType = TestParameterCursor<'a>

§

type PolicyIteratorType = IntoIter<TestPolicy>

§

type PolicyType = TestPolicy

source§

fn parameter_cursor(&self) -> Self::ParamType

Get the cursor to the parameter.
source§

fn metadata(&self) -> &Self::MetadataType

Get the reference to chain metadata
source§

fn policies(&self) -> Self::PolicyIteratorType

Policies of the sender of the message. For init methods this is the would-be creator of the contract, for the receive this is the policies of the immediate sender. Read more

Auto Trait Implementations§

§

impl<'a, C> Freeze for TestContext<'a, C>
where C: Freeze,

§

impl<'a, C> RefUnwindSafe for TestContext<'a, C>
where C: RefUnwindSafe,

§

impl<'a, C> !Send for TestContext<'a, C>

§

impl<'a, C> !Sync for TestContext<'a, C>

§

impl<'a, C> Unpin for TestContext<'a, C>
where C: Unpin,

§

impl<'a, C> UnwindSafe for TestContext<'a, C>
where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.