public void ContractAuditor_AcsRequired_Test() { var whiteList = new List <string> { "System.Collection", "System.Linq" }; var blackList = new List <string> { "System.Random", "System.DateTime" }; _auditor = new CSharpContractAuditor(whiteList, blackList); var requireAcs = new RequiredAcs(); requireAcs.AcsList = new List <string> { "acs1" }; Should.Throw <CSharpInvalidCodeException>(() => _auditor.Audit(_badContractCode, requireAcs)); Should.NotThrow(() => _auditor.Audit(_systemContractCode, requireAcs)); requireAcs.AcsList.Add("acs8"); Should.NotThrow(() => _auditor.Audit(_systemContractCode, requireAcs)); requireAcs.RequireAll = true; Should.Throw <CSharpInvalidCodeException>(() => _auditor.Audit(_systemContractCode, requireAcs)); }
public void ContractAuditor_Basic_Test() { var whiteList = new List <string> { "System.Collection", "System.Linq" }; var blackList = new List <string> { "System.Random", "System.DateTime" }; _auditor = new CSharpContractAuditor(blackList, whiteList); Should.Throw <InvalidCodeException>(() => _auditor.Audit(_badContractCode, _requiredAcs)); }
public void Audit(byte[] code) { _auditor.Audit(code, _requiredAcs); }
public void Audit(byte[] code, bool isSystemContract) { _auditor.Audit(code, _requiredAcs, isSystemContract); }