Struct abstract_testing::map_tester::CwMapTester
source · 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,
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,
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
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<'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§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<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 moresource§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