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 ContractAuditor(whiteList, blackList);

            var requireAcs = new RequiredAcsDto();

            requireAcs.AcsList = new List <string> {
                "acs1"
            };
            Should.Throw <InvalidCodeException>(() => _auditor.Audit(_badContractCode, requireAcs, true));

            Should.NotThrow(() => _auditor.Audit(_systemContractCode, requireAcs, true));

            requireAcs.AcsList.Add("acs8");
            Should.NotThrow(() => _auditor.Audit(_systemContractCode, requireAcs, true));

            requireAcs.RequireAll = true;
            Should.Throw <InvalidCodeException>(() => _auditor.Audit(_systemContractCode, requireAcs, true));
        }
 public ContractAuditorFixture()
 {
     _auditor     = new ContractAuditor(null, null);
     _requiredAcs = new RequiredAcsDto
     {
         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 ContractAuditor(blackList, whiteList);

            Should.Throw <InvalidCodeException>(() => _auditor.Audit(_badContractCode, _requiredAcs, true));
        }
 public void Dispose()
 {
     _auditor = null;
 }
 public ContractAuditorTests()
 {
     // Use fixture to instantiate auditor only once
     _auditor = GetRequiredService <ContractAuditor>();
     _patcher = GetRequiredService <IContractPatcher>();
 }