Untitled
unknown
plain_text
3 years ago
1.5 kB
7
Indexable
pragma solidity >=0.4.22 <0.9.0;
import "remix_tests.sol";
import "remix_accounts.sol";
import "../CSC8113proj.sol";
// Proxy contract to call addService on behalf of actorId
contract ActorProxy {
DataUsage dataUsage;
constructor(DataUsage _dataUsage) {
dataUsage = _dataUsage;
}
function addService(string memory _serviceName, string memory _servicePurpose, string memory _operation, string[] memory _personalData) public {
dataUsage.addService(_serviceName, _servicePurpose, _operation, _personalData);
}
}
contract testSuite {
DataUsage dataUsage;
Agreement agreement;
Log log;
Verification verification;
address constant actorId = 0x1234567890123456789012345678901234567890;
function beforeAll() public {
dataUsage = new DataUsage();
agreement = new Agreement();
log = new Log();
verification = new Verification(address(dataUsage), address(agreement), address(log));
}
function testCase1() public {
string[] memory personalData = new string[](2);
personalData[0] = "Account Number";
personalData[1] = "Transaction History";
// Deploy the ActorProxy contract with actorId
ActorProxy proxy = (new ActorProxy(address(dataUsage))){value: 0, salt: bytes32(actorId)}();
// Call the addService function through the proxy
proxy.addService("Banking Transactions", "Banking Services", "Write", personalData);
}
}
Editor is loading...