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 ContractAuditorFixture()
 {
     _auditor     = new CSharpContractAuditor(null, null);
     _requiredAcs = new RequiredAcs
     {
         AcsList = new[] { "acs1", "acs8" }.ToList(),
         RequireAll = false
     };
 }
 public ContractAuditor(CSharpContractAuditor contractAuditor)
 {
     _auditor     = contractAuditor;
     _requiredAcs = new RequiredAcs
     {
         AcsList = new[] { "acs1", "acs8" }.ToList(),
         RequireAll = false
     };
 }
        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 Dispose()
 {
     _auditor = null;
 }