Exemple #1
0
 public void Verify_that_it_returns_correct_values(RequirementStateOfCompliance requirementStateOfCompliance)
 {
     Assert.DoesNotThrow(() => requirementStateOfCompliance.GetHexColorValue());
     Assert.IsInstanceOf <string>(requirementStateOfCompliance.GetHexColorValue());
     Assert.DoesNotThrow(() => requirementStateOfCompliance.GetBrush());
     Assert.IsInstanceOf <Brush>(requirementStateOfCompliance.GetBrush());
 }
        /// <summary>
        /// Get the hexadecimal string value representation for a RequirementStateOfCompliance's color.
        /// </summary>
        /// <param name="stateOfCompliance">The <see cref="RequirementStateOfCompliance"/></param>
        /// <returns>Hexadecimal string value representation of the color</returns>
        public static string GetHexColorValue(this RequirementStateOfCompliance stateOfCompliance)
        {
            switch (stateOfCompliance)
            {
            case RequirementStateOfCompliance.Pass:
                return(CDP4Color.Succeeded.GetHexValue());

            case RequirementStateOfCompliance.Failed:
                return(CDP4Color.Failed.GetHexValue());

            case RequirementStateOfCompliance.Inconclusive:
                return(CDP4Color.Inconclusive.GetHexValue());

            default:
                return("#CCCCCC");
            }
        }
 /// <summary>
 /// Checks if the value of <see cref="RequirementStateOfCompliance"/> states that calculations are finished
 /// </summary>
 /// <param name="value"></param>
 /// <returns>true if value indicates that calculations are finished</returns>
 public static bool IsCalculated(this RequirementStateOfCompliance value) =>
 new[] { RequirementStateOfCompliance.Failed, RequirementStateOfCompliance.Pass, RequirementStateOfCompliance.Inconclusive }.Contains(value);
 /// <summary>
 /// Initializes a new instance of the <see cref="RequirementStateOfComplianceChangedEvent"/> class.
 /// </summary>
 /// <param name="requirementStateOfCompliance">
 /// The payload <see cref="RequirementStateOfCompliance"/>.
 /// </param>
 public RequirementStateOfComplianceChangedEvent(RequirementStateOfCompliance requirementStateOfCompliance)
 {
     this.RequirementStateOfCompliance = requirementStateOfCompliance;
 }
 /// <summary>
 /// Get the <see cref="SolidColorBrush"/> representation for a <see cref="RequirementStateOfCompliance"/>.
 /// </summary>
 /// <param name="stateOfCompliance">The <see cref="RequirementStateOfCompliance"/></param>
 /// <returns><see cref="SolidColorBrush"/></returns>
 public static Brush GetBrush(this RequirementStateOfCompliance stateOfCompliance)
 {
     return((SolidColorBrush) new BrushConverter().ConvertFrom(stateOfCompliance.GetHexColorValue()));
 }
Exemple #6
0
        public void Verify_that_state_of_compliances_are_properly_calculated(
            double value1, double value2, RelationalOperatorKind relationalOperatorKind, RequirementStateOfCompliance expectedResult)
        {
            var relationalExpression =
                new RelationalExpressionBuilder()
                .WithSimpleQuantityKindParameterType()
                .WithValue(value1)
                .WithRelationalOperatorKind(relationalOperatorKind)
                .Build();

            var parameter = new ParameterBuilder()
                            .WithSimpleQuantityKindParameterType()
                            .WithValue(value2)
                            .Build();

            Assert.AreEqual(expectedResult, this.requirementStateOfComplianceCalculator.Calculate(parameter.ValueSet[0], relationalExpression));
        }