Exemplo n.º 1
0
        public void NewRequirement_InvalidKey_ThrowsAnExceptio(long id, double pas, double alpha)
        {
            WeightFraction   PAS   = new WeightFraction(pas);
            CorrectionFactor Alpha = new CorrectionFactor(alpha);

            Assert.Throws <InvalidKeyException>(() =>
            {
                Requirement sr = new Requirement(id, PAS, Alpha, true);
            });
        }
Exemplo n.º 2
0
        public void NewRequirement_ValidParameter_ExceptedPropertiesAndDefaultWeightIsOne(long id, double pas, double alpha, int n)
        {
            WeightFraction PAS = new WeightFraction(pas);

            CorrectionFactor Alpha = new CorrectionFactor(alpha);

            Requirement req = new Requirement(id, PAS, Alpha, true); // Weights are 1 by default

            req.PAS.Value.Should().Be(pas);
            req.Alpha.Value.Should().Be(alpha);
            req.Id.Should().Be(id);
            req.Weights[n].Value.Should().Be(1); // check complianceweight n-element as default value
        }
Exemplo n.º 3
0
        public Requirement(long id, WeightFraction pas, CorrectionFactor alpha, bool adequate)
        {
            if (id <= 0)
            {
                throw new InvalidKeyException();
            }

            Id       = id;
            PAS      = pas;
            Alpha    = alpha;
            Adequate = adequate;

            Weights = new Weights(Enumerable.Repeat((Weight) new DefaultWeight(), WEIGHTS_NUM).ToList());
        }
Exemplo n.º 4
0
        public void CalculatePotentilRiskFactors_Scenario_CheckFactorsValue(
            double pas, double alpha,
            double prbia, double prbiaid, double prcompl)
        {
            WeightFraction PAS = new WeightFraction(pas);

            CorrectionFactor Alpha = new CorrectionFactor(alpha);

            Requirement req = new Requirement(101, PAS, Alpha, true, new int[38]
            {
                3, 1, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
            });

            List <int> totals = new List <int>(new int[38]
            {
                17, 13, 7, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
            });

            req.CalculatePotentialRisk(totals);

            R2(req.PotentialRiskBIA).Should().Be(prbia);
            R2(req.PotentialRiskBIAID).Should().Be(prbiaid);
            R2(req.PotentialRiskCOMPL).Should().Be(prcompl);
        }
Exemplo n.º 5
0
 public Requirement(long id, WeightFraction pas, CorrectionFactor alpha, bool adequate, int[] weights)
     : this(id, pas, alpha, adequate)
 {
     InitializeWeightsWithIntArray(weights);
 }