pub struct CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>{ /* private fields */ }
Implementations§
Source§impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> CwMapTester<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,
impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> CwMapTester<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,
pub fn new( info: MessageInfo, map: Map<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: (UncheckedK, UncheckedV), from_checked_entry: fn(_: (K::Output, V)) -> (UncheckedK, UncheckedV), ) -> Self
pub fn msg_builder( &self, to_add: Vec<(UncheckedK, UncheckedV)>, to_remove: Vec<UncheckedK>, ) -> ExecMsg
Sourcepub fn execute(&mut self, deps: DepsMut<'_>, msg: ExecMsg) -> Result<(), TError>
pub fn execute(&mut self, deps: DepsMut<'_>, msg: ExecMsg) -> Result<(), TError>
Execute the msg with the mock env
pub fn execute_update( &mut self, deps: DepsMut<'_>, (to_add, to_remove): (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>), ) -> Result<(), TError>
pub fn assert_expected_entries( &self, storage: &dyn Storage, expected: Vec<(UncheckedK, UncheckedV)>, )
pub fn test_add_one(&mut self, deps: &mut MockDeps) -> Result<(), TError>
pub fn test_add_one_twice(&mut self, deps: &mut MockDeps) -> Result<(), TError>
pub fn test_add_two_same(&mut self, deps: &mut MockDeps) -> Result<(), TError>
pub fn test_add_and_remove_same( &mut self, deps: &mut MockDeps, ) -> Result<(), TError>
pub fn test_remove_nonexistent( &mut self, deps: &mut MockDeps, ) -> Result<(), TError>
Sourcepub fn test_all(&mut self, deps: &mut MockDeps) -> Result<(), TError>
pub fn test_all(&mut self, deps: &mut MockDeps) -> Result<(), TError>
Run through all the preconfigured test scenarios
Sourcepub fn test_update_auto_expect(
&mut self,
deps: &mut MockDeps,
update: (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>),
) -> Result<(), TError>
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
Sourcepub fn test_update_with_expected(
&mut self,
deps: &mut MockDeps,
update: (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>),
expected: Vec<(UncheckedK, UncheckedV)>,
) -> Result<(), TError>
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<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Freeze for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> RefUnwindSafe for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Send for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Sync for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Unpin for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> UnwindSafe for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more