pub struct CwMapTester<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV>where
    K: PrimaryKey<'a> + KeyDeserialize + Debug,
    K::Output: 'static,{ /* private fields */ }

Implementations§

source§

impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> CwMapTester<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV>where V: Serialize + DeserializeOwned + Clone + Debug, K: PrimaryKey<'a> + KeyDeserialize + Debug, (&'a <K as KeyDeserialize>::Output, V): PartialEq<(K, V)>, K::Output: 'static, UncheckedK: Clone + PartialEq + Debug + Serialize, UncheckedV: Clone + PartialEq + Debug, <K as KeyDeserialize>::Output: Debug,

source

pub fn new( info: MessageInfo, map: Map<'a, K, V>, execute: fn(deps: DepsMut<'_>, env: Env, info: MessageInfo, msg: ExecMsg) -> Result<Response, TError>, msg_builder: fn(to_add: Vec<(UncheckedK, UncheckedV)>, to_remove: Vec<UncheckedK>) -> ExecMsg, mock_entry_builder: fn() -> (UncheckedK, UncheckedV), from_checked_entry: fn(_: (K::Output, V)) -> (UncheckedK, UncheckedV) ) -> Self

source

pub fn msg_builder( &self, to_add: Vec<(UncheckedK, UncheckedV)>, to_remove: Vec<UncheckedK> ) -> ExecMsg

source

pub fn execute(&mut self, deps: DepsMut<'_>, msg: ExecMsg) -> Result<(), TError>

Execute the msg with the mock env

source

pub fn execute_update( &mut self, deps: DepsMut<'_>, (to_add, to_remove): (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>) ) -> Result<(), TError>

source

pub fn assert_expected_entries( &self, storage: &dyn Storage, expected: Vec<(UncheckedK, UncheckedV)> )

source

pub fn test_add_one(&mut self, deps: &mut MockDeps) -> Result<(), TError>

source

pub fn test_add_one_twice(&mut self, deps: &mut MockDeps) -> Result<(), TError>

source

pub fn test_add_two_same(&mut self, deps: &mut MockDeps) -> Result<(), TError>

source

pub fn test_add_and_remove_same( &mut self, deps: &mut MockDeps ) -> Result<(), TError>

source

pub fn test_remove_nonexistent( &mut self, deps: &mut MockDeps ) -> Result<(), TError>

source

pub fn test_all(&mut self, deps: &mut MockDeps) -> Result<(), TError>

Run through all the preconfigured test scenarios

source

pub fn test_update_auto_expect( &mut self, deps: &mut MockDeps, update: (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>) ) -> Result<(), TError>

Test the manually provided arguments with the expected behavior, which is removing any duplicate entries that are within both add and remove

source

pub fn test_update_with_expected( &mut self, deps: &mut MockDeps, update: (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>), expected: Vec<(UncheckedK, UncheckedV)> ) -> Result<(), TError>

Provide an update nad expected result, and test that the expected result is returned

Auto Trait Implementations§

§

impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> RefUnwindSafe for CwMapTester<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV>where K: RefUnwindSafe, V: RefUnwindSafe,

§

impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> Send for CwMapTester<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV>where K: Send, V: Send,

§

impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> Sync for CwMapTester<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV>where K: Sync, V: Sync,

§

impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> Unpin for CwMapTester<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV>where K: Unpin, V: Unpin,

§

impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> UnwindSafe for CwMapTester<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV>where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> Twhere T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.