Esempio n. 1
0
        /// <summary>
        /// Extension method that converts a <see cref="RelationalOperatorKind"/> to a readable string
        /// </summary>
        /// <param name="value"><see cref="RelationalOperatorKind"/> to convert</param>
        /// <returns>String that contains a scientific representation of the <see cref="RelationalOperatorKind"/></returns>
        public static string ToScientificNotationString(this RelationalOperatorKind value)
        {
            switch (value)
            {
            case RelationalOperatorKind.EQ:
                return("=");

            case RelationalOperatorKind.GE:
                return("≥");

            case RelationalOperatorKind.GT:
                return(">");

            case RelationalOperatorKind.LT:
                return("<");

            case RelationalOperatorKind.LE:
                return("≤");

            case RelationalOperatorKind.NE:
                return("≠");

            default:
                return(value.ToString());
            }
        }
Esempio n. 2
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));
        }
        /// <summary>
        /// Set the <see cref="RelationalOperatorKind"/> to be set on the <see cref="RelationalExpression"/> when the <see cref="Build"/> method is used
        /// </summary>
        /// <param name="relationalOperatorKind"></param>
        /// <returns><see cref="RelationalExpressionBuilder"/> "this"</returns>
        public RelationalExpressionBuilder WithRelationalOperatorKind(RelationalOperatorKind relationalOperatorKind)
        {
            this.relationalOperatorKind = relationalOperatorKind;

            return(this);
        }