public static TransactionAdaptionEventModel RebuildCompletedEvent(
            GwOutcome gwOutcome,
            Guid?fileId = null,
            DateTimeOffset?timestamp = null)
        {
            var model = Create(EventId.RebuildCompleted, fileId, timestamp);

            model.Properties.Add("GwOutcome", gwOutcome.ToString());
            return(model);
        }
        public static Risk DetermineRisk(NcfsOutcome ncfsOutcome, GwOutcome gwOutcome)
        {
            Risk risk;

            switch (ncfsOutcome)
            {
            case NcfsOutcome.Relayed:
                risk = Risk.AllowedByNCFS;
                break;

            case NcfsOutcome.Replaced:
                risk = Risk.Safe;
                break;

            case NcfsOutcome.Blocked:
                risk = Risk.BlockedByNCFS;
                break;

            default:
                risk = Risk.Unknown;
                break;
            }

            if (risk != Risk.Unknown)
            {
                return(risk);
            }

            switch (gwOutcome)
            {
            case GwOutcome.Replace:
                risk = Risk.Safe;
                break;

            case GwOutcome.Unmodified:
                risk = Risk.AllowedByPolicy;
                break;

            case GwOutcome.Failed:
                risk = Risk.BlockedByPolicy;
                break;

            default:
                risk = Risk.Unknown;
                break;
            }

            return(risk);
        }
Exemplo n.º 3
0
        public void Correct_Risk_Is_Identified(NcfsOutcome ncfsOutcome, GwOutcome gwOutcome, Risk expected)
        {
            var actual = RiskAssessment.DetermineRisk(ncfsOutcome, gwOutcome);

            Assert.That(actual, Is.EqualTo(expected));
        }