pub struct TestEnvironment { /* private fields */ }Expand description
Test environment for Neo N3 contract testing
Implementations§
Source§impl TestEnvironment
impl TestEnvironment
pub fn new() -> Self
pub fn with_runtime(self, runtime: MockRuntime) -> Self
pub fn runtime(&self) -> &MockRuntime
pub fn runtime_mut(&mut self) -> &mut MockRuntime
pub fn set_storage(&mut self, key: &[u8], value: &[u8])
pub fn get_storage_context(&mut self) -> MockStorageContext
pub fn get_read_only_storage_context(&mut self) -> MockStorageContext
pub fn put_storage_with_context( &mut self, context: &MockStorageContext, key: &[u8], value: &[u8], ) -> Result<(), NeoError>
pub fn delete_storage_with_context( &mut self, context: &MockStorageContext, key: &[u8], ) -> Result<(), NeoError>
pub fn get_storage(&self, key: &[u8]) -> Option<Vec<u8>>
pub fn delete_storage(&mut self, key: &[u8])
pub fn set_trigger(&mut self, trigger: i32)
pub fn set_time(&mut self, time: i64)
pub fn set_network(&mut self, network: i64)
pub fn add_witness(&mut self, address: &[u8])
pub fn check_witness(&self, address: &[u8]) -> bool
pub fn add_log(&mut self, message: &str)
pub fn logs(&self) -> &[String]
pub fn clear_logs(&mut self)
pub fn assert_runtime(&self) -> RuntimeAssertions<'_>
pub fn assert_storage(&self) -> StorageAssertions<'_>
pub fn call_method<F, R>(&self, _name: &str, _args: &[NeoValue], _f: F) -> Rwhere
F: FnOnce() -> R,
pub fn deploy(&mut self, script: &[u8], manifest: &[u8]) -> TestResult
pub fn update(&mut self, script: &[u8]) -> TestResult
pub fn update_with_manifest( &mut self, script: &[u8], manifest: &[u8], ) -> TestResult
pub fn destroy(&mut self) -> TestResult
pub fn is_deployed(&self) -> bool
pub fn deployed_script(&self) -> Option<&[u8]>
pub fn deployed_manifest(&self) -> Option<&[u8]>
pub fn reset(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestEnvironment
impl RefUnwindSafe for TestEnvironment
impl Send for TestEnvironment
impl Sync for TestEnvironment
impl Unpin for TestEnvironment
impl UnsafeUnpin for TestEnvironment
impl UnwindSafe for TestEnvironment
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