N3developertoolkit / neo-test

Neo N3 smart contract unit test framework
MIT License
6 stars 2 forks source link

Mocking contract calls #52

Open SkyKarma opened 1 year ago

SkyKarma commented 1 year ago

A nice feature would be to allow mocking calls,

For example, my contract needs to call another contract on the blockchain like shown below, image

I want to be able to set up a test to say something like:

engine.Mock<Contract>(c => c.Call(params).Return(true);
engine.ExecuteScript<MyContract>(c => c.DoSomething(otherParams));

So I want to be able to mock the Neo.SmartContract.Framework.Services Contract class in this instance

Another nice feature would be to be able to mock datastorages as well.

SkyKarma commented 1 year ago

Another mock that would be nice to have is Neo.SmartContract.Framework.Services.Runtime, I want to be able to mock the Time,

Basically be able to mock anything that is in the Neo.SmartContract.Framework which I do not have control over :)