Exemplo n.º 1
0
        private static Mock <IRule> CreateRuleMock(Condition condition, EvaluationCode code, A11yElement e)
        {
            var infoStub = new RuleInfo();

            var ruleMock = new Mock <IRule>(MockBehavior.Strict);

            ruleMock.Setup(m => m.Condition).Returns(() => condition).Verifiable();
            ruleMock.Setup(m => m.Evaluate(e)).Returns(() => code).Verifiable();
            ruleMock.Setup(m => m.Info).Returns(() => infoStub).Verifiable();

            return(ruleMock);
        }
Exemplo n.º 2
0
        public static ScanStatus ConvertEvaluationCodeToScanStatus(EvaluationCode evaluationCode)
        {
            switch (evaluationCode)
            {
            case EvaluationCode.RuleExecutionError:
                return(ScanStatus.ScanNotSupported);

            case EvaluationCode.Error:
                return(ScanStatus.Fail);

            case EvaluationCode.NeedsReview:
            case EvaluationCode.Warning:
                return(ScanStatus.Uncertain);

            case EvaluationCode.NotApplicable:
                return(ScanStatus.Pass);    // to avoid error in UI.
            } // switch

            return(ScanStatus.Pass);
        }