diff --git a/CDP4RequirementsVerification.Tests/Builders/ParameterBuilder.cs b/CDP4RequirementsVerification.Tests/Builders/ParameterBuilder.cs index 31ffff9d3..2c9ed6314 100644 --- a/CDP4RequirementsVerification.Tests/Builders/ParameterBuilder.cs +++ b/CDP4RequirementsVerification.Tests/Builders/ParameterBuilder.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -21,9 +21,11 @@ // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // -------------------------------------------------------------------------------------------------------------------- + namespace CDP4RequirementsVerification.Tests.Builders { using System; + using System.Linq; using CDP4Common.CommonData; using CDP4Common.EngineeringModelData; @@ -36,9 +38,9 @@ namespace CDP4RequirementsVerification.Tests.Builders public class ParameterBuilder { /// - /// The + /// The s /// - private Option option; + private Option[] options; /// /// The @@ -46,9 +48,9 @@ public class ParameterBuilder private ScalarParameterType parameterType; /// - /// The + /// The s /// - private ValueArray values; + private ValueArray[] values; /// /// The @@ -60,9 +62,9 @@ public class ParameterBuilder /// /// The /// "this" - public ParameterBuilder WithOption(Option option) + public ParameterBuilder WithOptions(params Option[] options) { - this.option = option; + this.options = options; return this; } @@ -88,7 +90,19 @@ public ParameterBuilder WithSimpleQuantityKindParameterType() /// "this" public ParameterBuilder WithValue(object value) { - this.values = new ValueArray(new[] { value.ToString() }); + this.values = new [] { new ValueArray(new[] { value.ToString() })}; + + return this; + } + + /// + /// Create a to be added to the when the method is used + /// + /// The values to be converted to s + /// "this" + public ParameterBuilder WithValues(params object[] values) + { + this.values = values.Select(x => new ValueArray (new [] { x.ToString() })).ToArray(); return this; } @@ -116,15 +130,30 @@ public Parameter Build() ParameterType = this.parameterType ?? throw new NullReferenceException($"{nameof(this.parameterType)} not set") }; - var parameterValueSet = - new ParameterValueSet - { - ActualOption = this.option, - ValueSwitch = ParameterSwitchKind.MANUAL, - Manual = this.values ?? throw new NullReferenceException($"{nameof(this.values)} not set") - }; + if (this.values == null) + { + throw new NullReferenceException($"{nameof(this.values)} not set"); + } + + for (var i=0; i < this.options.Length;i++) + { + var option = this.options[i]; + + var parameterValueSet = + new ParameterValueSet + { + ActualOption = option, + ValueSwitch = ParameterSwitchKind.MANUAL, + Manual = this.values.Length == 1 ? this.values[0] : this.values[i] + }; - parameter.ValueSet.Add(parameterValueSet); + parameter.ValueSet.Add(parameterValueSet); + } + + if (this.options.Length > 1) + { + parameter.IsOptionDependent = true; + } this.elementDefinition?.Parameter.Add(parameter); diff --git a/CDP4RequirementsVerification.Tests/Verifiers/ParametricConstraintVerifierTestFixture.cs b/CDP4RequirementsVerification.Tests/Verifiers/ParametricConstraintVerifierTestFixture.cs index 83013130f..42428ecc0 100644 --- a/CDP4RequirementsVerification.Tests/Verifiers/ParametricConstraintVerifierTestFixture.cs +++ b/CDP4RequirementsVerification.Tests/Verifiers/ParametricConstraintVerifierTestFixture.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -21,6 +21,7 @@ // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // -------------------------------------------------------------------------------------------------------------------- + namespace CDP4RequirementsVerification.Tests.Verifiers { using System; @@ -40,7 +41,7 @@ namespace CDP4RequirementsVerification.Tests.Verifiers [TestFixture] public class ParametricConstraintVerifierTestFixture { - private ParametricConstraintVerifier parametricConstraintVerifier; + private ParametricConstraintVerifier nullConfigurationParametricConstraintVerifier; private ParametricConstraint parametricConstraint; @@ -75,6 +76,8 @@ public class ParametricConstraintVerifierTestFixture private Option option2; private ElementDefinition elementDefinition; + private ParametricConstraintVerifier option1ConfigurationParametricConstraintVerifier; + private ParametricConstraintVerifier option2ConfigurationParametricConstraintVerifier; [SetUp] public void SetUp() @@ -125,8 +128,6 @@ public void SetUp() this.parametricConstraint.Expression.Add(this.relationalExpression3); this.parametricConstraint.Expression.Add(this.relationalExpression4); - this.parametricConstraintVerifier = new ParametricConstraintVerifier(this.parametricConstraint); - this.iteration = new Iteration(Guid.NewGuid(), null, null); this.option1 = new Option(); @@ -134,15 +135,19 @@ public void SetUp() this.iteration.Option.Add(this.option1); this.iteration.Option.Add(this.option2); + this.nullConfigurationParametricConstraintVerifier = new ParametricConstraintVerifier(this.parametricConstraint, null); + this.option1ConfigurationParametricConstraintVerifier = new ParametricConstraintVerifier(this.parametricConstraint, new RequirementVerificationConfiguration { Option = this.option1}); + this.option2ConfigurationParametricConstraintVerifier = new ParametricConstraintVerifier(this.parametricConstraint, new RequirementVerificationConfiguration { Option = this.option2 }); + this.elementDefinition = new ElementDefinition(Guid.NewGuid(), null, null); var elementUsage = new ElementUsage(Guid.NewGuid(), null, null) { ElementDefinition = this.elementDefinition }; this.elementDefinition.ContainedElement.Add(elementUsage); this.parameter = new ParameterBuilder() - .WithOption(this.option1) + .WithOptions(this.option1) .WithSimpleQuantityKindParameterType() - .WithValue(OkValue) + .WithValues(OkValue) .AddToElementDefinition(this.elementDefinition) .Build(); @@ -175,19 +180,19 @@ private void RegisterBinaryRelationShip(ParameterOrOverrideBase parameter, Relat [Test] public async Task Verify_that_state_of_compliances_are_properly_set_when_valuesets_match() { - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); } [Test] @@ -196,38 +201,38 @@ public async Task Verify_that_state_of_compliances_are_properly_set_when_valuese this.parameter.ValueSet[0].Manual = new ValueArray(new[] { NotOkValue }); this.parameterOverrideValueSet.Manual = new ValueArray(new[] { NotOkValue }); - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); } [Test] public async Task Verify_that_state_of_compliances_are_properly_set_when_a_notExpression_is_used_on_a_orExpression_that_is_compliant() { this.notExpression.Term = this.orExpression; - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); } [Test] @@ -237,19 +242,19 @@ public async Task Verify_that_state_of_compliances_are_properly_set_when_a_notEx this.parameter.ValueSet[0].Manual = new ValueArray(new[] { NotOkValue }); this.parameterOverrideValueSet.Manual = new ValueArray(new[] { NotOkValue }); - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); } [Test] @@ -257,33 +262,33 @@ public async Task Verify_that_state_of_compliances_are_properly_set_when_a_orExp { this.parameterOverrideValueSet.Manual = new ValueArray(new[] { NotOkValue }); - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Inconclusive, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); } [Test] public async Task Verify_that_state_of_compliances_are_properly_set_when_valuesets_are_compliant() { var parameter1 = new ParameterBuilder() - .WithOption(this.option1) + .WithOptions(this.option1) .WithSimpleQuantityKindParameterType() .WithValue(OkValue) .AddToElementDefinition(this.elementDefinition) .Build(); var parameter2 = new ParameterBuilder() - .WithOption(this.option1) + .WithOptions(this.option1) .WithSimpleQuantityKindParameterType() .WithValue(OkValue) .AddToElementDefinition(this.elementDefinition) @@ -294,41 +299,41 @@ public async Task Verify_that_state_of_compliances_are_properly_set_when_valuese this.notExpression.Term = this.andExpression; - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); this.notExpression.Term = this.exclusiveOrExpression; - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); } [Test] public async Task Verify_that_state_of_compliances_are_properly_set_when_valuesets_are_not_compliant() { var parameter1 = new ParameterBuilder() - .WithOption(this.option1) + .WithOptions(this.option1) .WithSimpleQuantityKindParameterType() .WithValue(NotOkValue) .AddToElementDefinition(this.elementDefinition) .Build(); var parameter2 = new ParameterBuilder() - .WithOption(this.option1) + .WithOptions(this.option1) .WithSimpleQuantityKindParameterType() .WithValue(NotOkValue) .AddToElementDefinition(this.elementDefinition) @@ -339,40 +344,40 @@ public async Task Verify_that_state_of_compliances_are_properly_set_when_valuese this.notExpression.Term = this.andExpression; - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); this.notExpression.Term = this.exclusiveOrExpression; - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); } [Test] public async Task Verify_that_state_of_compliances_are_properly_set_when_valuesets_are_partially_compliant() { var parameter1 = new ParameterBuilder() - .WithOption(this.option1) + .WithOptions(this.option1) .WithSimpleQuantityKindParameterType() .WithValue(NotOkValue) .AddToElementDefinition(this.elementDefinition) .Build(); var parameter2 = new ParameterBuilder() - .WithOption(this.option1) + .WithOptions(this.option1) .WithSimpleQuantityKindParameterType() .WithValue(OkValue) .AddToElementDefinition(this.elementDefinition) @@ -383,26 +388,114 @@ public async Task Verify_that_state_of_compliances_are_properly_set_when_valuese this.notExpression.Term = this.andExpression; - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); + + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); + + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + + this.notExpression.Term = this.exclusiveOrExpression; + await this.nullConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); + + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.nullConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + } + + [Test] + public async Task Verify_that_state_of_compliances_are_properly_set_when_valuesets_are_partially_compliant_for_option1() + { + var parameter1 = new ParameterBuilder() + .WithOptions(this.option1, this.option2) + .WithSimpleQuantityKindParameterType() + .WithValues(NotOkValue, OkValue) + .AddToElementDefinition(this.elementDefinition) + .Build(); + + var parameter2 = new ParameterBuilder() + .WithOptions(this.option1, this.option2) + .WithSimpleQuantityKindParameterType() + .WithValues(OkValue, NotOkValue) + .AddToElementDefinition(this.elementDefinition) + .Build(); + + this.RegisterBinaryRelationShip(parameter1, this.relationalExpression3); + this.RegisterBinaryRelationShip(parameter2, this.relationalExpression4); + + this.notExpression.Term = this.andExpression; + + await this.option1ConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); + + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option1ConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); + + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + + this.notExpression.Term = this.exclusiveOrExpression; + await this.option1ConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); + + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option1ConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option1ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + } + + [Test] + public async Task Verify_that_state_of_compliances_are_properly_set_when_valuesets_are_partially_compliant_for_option2() + { + var parameter1 = new ParameterBuilder() + .WithOptions(this.option1, this.option2) + .WithSimpleQuantityKindParameterType() + .WithValues(OkValue, NotOkValue) + .AddToElementDefinition(this.elementDefinition) + .Build(); + + var parameter2 = new ParameterBuilder() + .WithOptions(this.option1, this.option2) + .WithSimpleQuantityKindParameterType() + .WithValues(NotOkValue, OkValue) + .AddToElementDefinition(this.elementDefinition) + .Build(); + + this.RegisterBinaryRelationShip(parameter1, this.relationalExpression3); + this.RegisterBinaryRelationShip(parameter2, this.relationalExpression4); + + this.notExpression.Term = this.andExpression; + + await this.option2ConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option2ConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression1].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression2].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.orExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression3].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.relationalExpression4].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Pass, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.andExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.exclusiveOrExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Pass, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); this.notExpression.Term = this.exclusiveOrExpression; - await this.parametricConstraintVerifier.VerifyRequirements(this.iteration); + await this.option2ConfigurationParametricConstraintVerifier.VerifyRequirements(this.iteration); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.RequirementStateOfCompliance); - Assert.AreEqual(RequirementStateOfCompliance.Failed, this.parametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option2ConfigurationParametricConstraintVerifier.RequirementStateOfCompliance); + Assert.AreEqual(RequirementStateOfCompliance.Failed, this.option2ConfigurationParametricConstraintVerifier.BooleanExpressionVerifiers[this.notExpression].RequirementStateOfCompliance); } } } diff --git a/CDP4RequirementsVerification.Tests/Verifiers/RelationalExpressionVerifierTestFixture.cs b/CDP4RequirementsVerification.Tests/Verifiers/RelationalExpressionVerifierTestFixture.cs index acb4d9803..36a960b33 100644 --- a/CDP4RequirementsVerification.Tests/Verifiers/RelationalExpressionVerifierTestFixture.cs +++ b/CDP4RequirementsVerification.Tests/Verifiers/RelationalExpressionVerifierTestFixture.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -21,6 +21,7 @@ // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // -------------------------------------------------------------------------------------------------------------------- + namespace CDP4RequirementsVerification.Tests.Verifiers { using System; @@ -78,7 +79,7 @@ public void SetUp() this.RegisterBinaryRelationShip(parameter, this.relationalExpression); - this.relationalExpressionVerifier = new RelationalExpressionVerifier(this.relationalExpression); + this.relationalExpressionVerifier = new RelationalExpressionVerifier(this.relationalExpression, null); } [TearDown] diff --git a/CDP4RequirementsVerification.Tests/Verifiers/RequirementsContainerVerifierTestFixture.cs b/CDP4RequirementsVerification.Tests/Verifiers/RequirementsContainerVerifierTestFixture.cs index 36b603a04..92a57c753 100644 --- a/CDP4RequirementsVerification.Tests/Verifiers/RequirementsContainerVerifierTestFixture.cs +++ b/CDP4RequirementsVerification.Tests/Verifiers/RequirementsContainerVerifierTestFixture.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2021 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -21,6 +21,7 @@ // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // -------------------------------------------------------------------------------------------------------------------- + namespace CDP4RequirementsVerification.Tests.Verifiers { using System; @@ -86,10 +87,10 @@ public void SetUp() this.requirement1.Group = this.requirementsGroup1; - this.requirementsContainerVerifier = new RequirementsContainerVerifier(this.requirementsSpecification); + this.requirementsContainerVerifier = new RequirementsContainerVerifier(this.requirementsSpecification, null); - this.requirementsGroupVerifier1 = new RequirementsContainerVerifier(this.requirementsGroup1); - this.requirementsGroupVerifier2 = new RequirementsContainerVerifier(this.requirementsGroup2); + this.requirementsGroupVerifier1 = new RequirementsContainerVerifier(this.requirementsGroup1, null); + this.requirementsGroupVerifier2 = new RequirementsContainerVerifier(this.requirementsGroup2, null); this.iteration = new Iteration(Guid.NewGuid(), null, null); diff --git a/CDP4RequirementsVerification.Tests/Verifiers/RequirementsVerifierTestFixture.cs b/CDP4RequirementsVerification.Tests/Verifiers/RequirementsVerifierTestFixture.cs index ce93d74f7..8d45df507 100644 --- a/CDP4RequirementsVerification.Tests/Verifiers/RequirementsVerifierTestFixture.cs +++ b/CDP4RequirementsVerification.Tests/Verifiers/RequirementsVerifierTestFixture.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -21,6 +21,7 @@ // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // -------------------------------------------------------------------------------------------------------------------- + namespace CDP4RequirementsVerification.Tests.Verifiers { using System; @@ -68,7 +69,7 @@ public void SetUp() this.requirement.ParametricConstraint.Add(this.parametricConstraint); - this.requirementVerifier = new RequirementVerifier(this.requirement); + this.requirementVerifier = new RequirementVerifier(this.requirement, null); this.iteration = new Iteration(Guid.NewGuid(), null, null); @@ -109,7 +110,6 @@ public async Task Verify_that_state_of_compliances_are_properly_calculated() await this.requirementVerifier.VerifyRequirements(this.iteration); Assert.AreEqual(RequirementStateOfCompliance.Pass, this.requirementVerifier.RequirementStateOfCompliance); - } [Test] diff --git a/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj b/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj index b5d5372d9..643349907 100644 --- a/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj +++ b/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj @@ -4,7 +4,7 @@ net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;netstandard2.0;netstandard2.1;netcoreapp3.1 RHEA System S.A. CDP4RequirementsVerification Community Edition - 0.11.0 + 0.12.0 CDP4 Class Library that provides requirement verification Copyright © RHEA System S.A. Sam, Alex, Alexander, Yevhen, Nathanael diff --git a/CDP4RequirementsVerification/Verifiers/AndExpressionVerifier.cs b/CDP4RequirementsVerification/Verifiers/AndExpressionVerifier.cs index 2e1dfe44b..65d07176a 100644 --- a/CDP4RequirementsVerification/Verifiers/AndExpressionVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/AndExpressionVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -37,9 +37,10 @@ public class AndExpressionVerifier : BooleanExpressionVerifier { /// /// Initializes a new instance of the class. - /// + /// /// The that is verified. - public AndExpressionVerifier(AndExpression andExpression) + /// The + public AndExpressionVerifier(AndExpression andExpression, IRequirementVerificationConfiguration configuration) : base(configuration) { this.Expression = andExpression; } diff --git a/CDP4RequirementsVerification/Verifiers/BaseVerifier.cs b/CDP4RequirementsVerification/Verifiers/BaseVerifier.cs new file mode 100644 index 000000000..52db63acc --- /dev/null +++ b/CDP4RequirementsVerification/Verifiers/BaseVerifier.cs @@ -0,0 +1,46 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2015-2022 RHEA System S.A. +// +// Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov +// +// This file is part of CDP4-SDK Community Edition +// +// The CDP4-SDK Community Edition is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// The CDP4-SDK Community Edition is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace CDP4RequirementsVerification.Verifiers +{ + /// + /// Abstract base class for all Requirement State of Compliance verifiers. + /// + public abstract class BaseVerifier + { + /// + /// The + /// + public IRequirementVerificationConfiguration Configuration { get; } + + /// + /// Creates a new instance of the class + /// + /// The to be used. + protected BaseVerifier(IRequirementVerificationConfiguration configuration) + { + this.Configuration = configuration; + } + } +} diff --git a/CDP4RequirementsVerification/Verifiers/BooleanExpressionVerifier.cs b/CDP4RequirementsVerification/Verifiers/BooleanExpressionVerifier.cs index 446590eec..acf9b1b7a 100644 --- a/CDP4RequirementsVerification/Verifiers/BooleanExpressionVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/BooleanExpressionVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -37,7 +37,7 @@ namespace CDP4RequirementsVerification.Verifiers /// Base class for the verification if a is compliant to data in an /// /// The type of that is used for this verifier. - public abstract class BooleanExpressionVerifier : IBooleanExpressionVerifier where T : BooleanExpression + public abstract class BooleanExpressionVerifier : BaseVerifier, IBooleanExpressionVerifier where T : BooleanExpression { /// /// Backing field for @@ -54,6 +54,14 @@ public abstract class BooleanExpressionVerifier : IBooleanExpressionVerifier /// protected bool IsMessageBusActive { get; set; } = true; + /// + /// Creates a new instance of the class. + /// + /// + protected BooleanExpressionVerifier(IRequirementVerificationConfiguration configuration) : base(configuration) + { + } + /// /// The current /// diff --git a/CDP4RequirementsVerification/Verifiers/ExclusiveOrExpressionVerifier.cs b/CDP4RequirementsVerification/Verifiers/ExclusiveOrExpressionVerifier.cs index 195347e80..42d8c6008 100644 --- a/CDP4RequirementsVerification/Verifiers/ExclusiveOrExpressionVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/ExclusiveOrExpressionVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -39,7 +39,8 @@ public class ExclusiveOrExpressionVerifier : BooleanExpressionVerifier class. /// /// The that is verified. - public ExclusiveOrExpressionVerifier(ExclusiveOrExpression exclusiveOrExpression) + /// The + public ExclusiveOrExpressionVerifier(ExclusiveOrExpression exclusiveOrExpression, IRequirementVerificationConfiguration configuration) : base(configuration) { this.Expression = exclusiveOrExpression; } diff --git a/CDP4RequirementsVerification/Verifiers/IRequirementVerificationConfiguration.cs b/CDP4RequirementsVerification/Verifiers/IRequirementVerificationConfiguration.cs new file mode 100644 index 000000000..ca8890fa4 --- /dev/null +++ b/CDP4RequirementsVerification/Verifiers/IRequirementVerificationConfiguration.cs @@ -0,0 +1,47 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2015-2022 RHEA System S.A. +// +// Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov +// +// This file is part of CDP4-SDK Community Edition +// +// The CDP4-SDK Community Edition is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// The CDP4-SDK Community Edition is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace CDP4RequirementsVerification.Verifiers +{ + + using CDP4Common.EngineeringModelData; + + /// + /// Defines that an object implements Requirement Verification Configuration setings and helper methods + /// + public interface IRequirementVerificationConfiguration + { + /// + /// The to use during RelationalExpression verification + /// + Option Option { get; set; } + + /// + /// Checks if a is eligible for usage during RelationalExpression verification + /// + /// The to check. + /// A boolean indicating that usage of the is eligible + bool IsValueSetAllowed(ParameterValueSetBase valueSet); + } +} diff --git a/CDP4RequirementsVerification/Verifiers/NotExpressionVerifier.cs b/CDP4RequirementsVerification/Verifiers/NotExpressionVerifier.cs index 067bebae6..f7817002e 100644 --- a/CDP4RequirementsVerification/Verifiers/NotExpressionVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/NotExpressionVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -38,7 +38,8 @@ public class NotExpressionVerifier : BooleanExpressionVerifier /// Initializes a new instance of the class. /// /// The that is verified. - public NotExpressionVerifier(NotExpression notExpression) + /// The + public NotExpressionVerifier(NotExpression notExpression, IRequirementVerificationConfiguration configuration) : base(configuration) { this.Expression = notExpression; } diff --git a/CDP4RequirementsVerification/Verifiers/OrExpressionVerifier.cs b/CDP4RequirementsVerification/Verifiers/OrExpressionVerifier.cs index 5bee27c4c..d5932cbac 100644 --- a/CDP4RequirementsVerification/Verifiers/OrExpressionVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/OrExpressionVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -39,7 +39,8 @@ public class OrExpressionVerifier : BooleanExpressionVerifier /// Initializes a new instance of the class. /// /// The that is verified. - public OrExpressionVerifier(OrExpression orExpression) + /// The + public OrExpressionVerifier(OrExpression orExpression, IRequirementVerificationConfiguration configuration) : base(configuration) { this.Expression = orExpression; } diff --git a/CDP4RequirementsVerification/Verifiers/ParametricConstraintVerifier.cs b/CDP4RequirementsVerification/Verifiers/ParametricConstraintVerifier.cs index 943e4a32b..68cf9304f 100644 --- a/CDP4RequirementsVerification/Verifiers/ParametricConstraintVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/ParametricConstraintVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -29,16 +29,16 @@ namespace CDP4RequirementsVerification.Verifiers using System.Threading.Tasks; using CDP4Common.EngineeringModelData; + using CDP4Common.Extensions; using CDP4Dal; using CDP4RequirementsVerification.Events; - using CDP4Common.Extensions; /// /// Class used for the verification if a is compliant to data in an /// - public class ParametricConstraintVerifier : IBooleanExpressionVerifier + public class ParametricConstraintVerifier : BaseVerifier, IBooleanExpressionVerifier { /// /// The internally used for verification @@ -80,7 +80,8 @@ private set /// Initializes this instance of /// /// The that is used for verification - public ParametricConstraintVerifier(ParametricConstraint parametricConstraint) + /// The + public ParametricConstraintVerifier(ParametricConstraint parametricConstraint, IRequirementVerificationConfiguration configuration) : base(configuration) { this.parametricConstraint = parametricConstraint; } @@ -155,27 +156,27 @@ private IBooleanExpressionVerifier GetBooleanExpressionVerifier(BooleanExpressio { if (booleanExpression is NotExpression notExpression) { - return new NotExpressionVerifier(notExpression); + return new NotExpressionVerifier(notExpression, this.Configuration); } if (booleanExpression is AndExpression andExpression) { - return new AndExpressionVerifier(andExpression); + return new AndExpressionVerifier(andExpression, this.Configuration); } if (booleanExpression is OrExpression orExpression) { - return new OrExpressionVerifier(orExpression); + return new OrExpressionVerifier(orExpression, this.Configuration); } if (booleanExpression is ExclusiveOrExpression exclusiveOrExpression) { - return new ExclusiveOrExpressionVerifier(exclusiveOrExpression); + return new ExclusiveOrExpressionVerifier(exclusiveOrExpression, this.Configuration); } if (booleanExpression is RelationalExpression relationalExpression) { - return new RelationalExpressionVerifier(relationalExpression); + return new RelationalExpressionVerifier(relationalExpression, this.Configuration); } return null; diff --git a/CDP4RequirementsVerification/Verifiers/RelationalExpressionVerifier.cs b/CDP4RequirementsVerification/Verifiers/RelationalExpressionVerifier.cs index f86ac8c09..fe9d329d8 100644 --- a/CDP4RequirementsVerification/Verifiers/RelationalExpressionVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/RelationalExpressionVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -47,15 +47,17 @@ public class RelationalExpressionVerifier : BooleanExpressionVerifier class. /// /// The that is verified. - public RelationalExpressionVerifier(RelationalExpression relationalExpression) + /// The + public RelationalExpressionVerifier(RelationalExpression relationalExpression, IRequirementVerificationConfiguration configuration) : base(configuration) { this.Expression = relationalExpression; + this.VerifiedRequirementStateOfComplianceList = new VerifiedRequirementStateOfComplianceList(new RequirementStateOfComplianceCalculator(), configuration); } /// /// A list containing all the s that were found when verifying data ( and ) /// - public VerifiedRequirementStateOfComplianceList VerifiedRequirementStateOfComplianceList { get; } = new VerifiedRequirementStateOfComplianceList(new RequirementStateOfComplianceCalculator()); + public VerifiedRequirementStateOfComplianceList VerifiedRequirementStateOfComplianceList { get; } /// /// Verify a with respect to a using data from a given diff --git a/CDP4RequirementsVerification/Verifiers/RequirementVerificationConfiguration.cs b/CDP4RequirementsVerification/Verifiers/RequirementVerificationConfiguration.cs new file mode 100644 index 000000000..4bae5e934 --- /dev/null +++ b/CDP4RequirementsVerification/Verifiers/RequirementVerificationConfiguration.cs @@ -0,0 +1,56 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2015-2022 RHEA System S.A. +// +// Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov +// +// This file is part of CDP4-SDK Community Edition +// +// The CDP4-SDK Community Edition is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// The CDP4-SDK Community Edition is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace CDP4RequirementsVerification.Verifiers +{ + + using CDP4Common.EngineeringModelData; + + /// + /// Implements the for usage as general configuration setting during + /// Requirement Verification + /// + public class RequirementVerificationConfiguration : IRequirementVerificationConfiguration + { + /// + /// The to use during RelationalExpression verification + /// + public Option Option { get; set; } + + /// + /// Checks if a is eligible for usage during RelationalExpression verification + /// + /// The to check. + /// A boolean indicating that usage of the is eligible + public bool IsValueSetAllowed(ParameterValueSetBase valueSet) + { + if (this.Option != null && ((valueSet.Container as ParameterOrOverrideBase)?.IsOptionDependent ?? false)) + { + return valueSet.ActualOption == this.Option; + } + + return true; + } + } +} diff --git a/CDP4RequirementsVerification/Verifiers/RequirementVerifier.cs b/CDP4RequirementsVerification/Verifiers/RequirementVerifier.cs index 496b32a80..836cf4bff 100644 --- a/CDP4RequirementsVerification/Verifiers/RequirementVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/RequirementVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -37,7 +37,7 @@ namespace CDP4RequirementsVerification.Verifiers /// /// Class used for the verification if a is compliant to data in an /// - public class RequirementVerifier : IHaveRequirementStateOfCompliance + public class RequirementVerifier : BaseVerifier, IHaveRequirementStateOfCompliance { /// /// The internally used for verification @@ -79,7 +79,8 @@ private set /// Initializes this instance of /// /// The used for verification - public RequirementVerifier(Requirement requirement) + /// The + public RequirementVerifier(Requirement requirement, IRequirementVerificationConfiguration configuration) : base(configuration) { this.requirement = requirement; } @@ -99,7 +100,7 @@ public async Task VerifyRequirements(Iteration ite foreach (var parametricConstraint in this.requirement.ParametricConstraint) { - var parametricConstraintVerifier = new ParametricConstraintVerifier((ParametricConstraint)parametricConstraint); + var parametricConstraintVerifier = new ParametricConstraintVerifier((ParametricConstraint)parametricConstraint, this.Configuration); this.parametricConstraintVerifiers.Add(parametricConstraintVerifier); tasks.Add(parametricConstraintVerifier.VerifyRequirements(iteration)); diff --git a/CDP4RequirementsVerification/Verifiers/RequirementsContainerVerifier.cs b/CDP4RequirementsVerification/Verifiers/RequirementsContainerVerifier.cs index f053af49a..0c3f2a389 100644 --- a/CDP4RequirementsVerification/Verifiers/RequirementsContainerVerifier.cs +++ b/CDP4RequirementsVerification/Verifiers/RequirementsContainerVerifier.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2020 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -38,7 +38,7 @@ namespace CDP4RequirementsVerification.Verifiers /// /// Class used for the verification if a is compliant to data in an /// - public class RequirementsContainerVerifier : IHaveRequirementStateOfCompliance + public class RequirementsContainerVerifier : BaseVerifier, IHaveRequirementStateOfCompliance { /// /// The internally used for verification @@ -75,7 +75,8 @@ private set /// Initializes this instance of /// /// The container - public RequirementsContainerVerifier(RequirementsContainer container) + /// The + public RequirementsContainerVerifier(RequirementsContainer container, IRequirementVerificationConfiguration configuration) : base(configuration) { this.Container = container; } @@ -94,7 +95,7 @@ public async Task VerifyRequirements(Iteration ite foreach (var requirementsGroup in this.Container.Group) { - var requirementsContainerVerifier = new RequirementsContainerVerifier(requirementsGroup); + var requirementsContainerVerifier = new RequirementsContainerVerifier(requirementsGroup, this.Configuration); verifiers.Add(requirementsContainerVerifier); tasks.Add(requirementsContainerVerifier.VerifyRequirements(iteration)); } @@ -103,7 +104,7 @@ public async Task VerifyRequirements(Iteration ite { foreach (var requirement in this.GetAllowedRequirements(requirementsSpecification.Requirement)) { - var requirementsVerifier = new RequirementVerifier(requirement); + var requirementsVerifier = new RequirementVerifier(requirement, this.Configuration); verifiers.Add(requirementsVerifier); tasks.Add(requirementsVerifier.VerifyRequirements(iteration)); } @@ -119,7 +120,7 @@ public async Task VerifyRequirements(Iteration ite { if (allRelatedGroups.Contains(requirement.Group)) { - var requirementsVerifier = new RequirementVerifier(requirement); + var requirementsVerifier = new RequirementVerifier(requirement, this.Configuration); verifiers.Add(requirementsVerifier); tasks.Add(requirementsVerifier.VerifyRequirements(iteration)); } diff --git a/CDP4RequirementsVerification/Verifiers/VerifiedRequirementStateOfComplianceList.cs b/CDP4RequirementsVerification/Verifiers/VerifiedRequirementStateOfComplianceList.cs index c8adb3948..152cca779 100644 --- a/CDP4RequirementsVerification/Verifiers/VerifiedRequirementStateOfComplianceList.cs +++ b/CDP4RequirementsVerification/Verifiers/VerifiedRequirementStateOfComplianceList.cs @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2015-2019 RHEA System S.A. +// Copyright (c) 2015-2022 RHEA System S.A. // // Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Yevhen Ikonnykov // @@ -36,15 +36,25 @@ namespace CDP4RequirementsVerification.Verifiers /// public class VerifiedRequirementStateOfComplianceList : Dictionary { + /// + /// The + /// private readonly IRequirementStateOfComplianceCalculator requirementStateOfComplianceCalculator; + /// + /// The + /// + private readonly IRequirementVerificationConfiguration configuration; + /// /// Initializes an instance of /// /// Implementation of that will be used to calculate the - public VerifiedRequirementStateOfComplianceList(IRequirementStateOfComplianceCalculator requirementStateOfComplianceCalculator) + /// The to be used when selecting ValueSets to calculate compliance for + public VerifiedRequirementStateOfComplianceList(IRequirementStateOfComplianceCalculator requirementStateOfComplianceCalculator, IRequirementVerificationConfiguration configuration) { this.requirementStateOfComplianceCalculator = requirementStateOfComplianceCalculator; + this.configuration = configuration; } /// @@ -56,7 +66,7 @@ public void VerifyAndAdd(IEnumerable valueSets, Relationa { foreach (var valueSet in valueSets) { - if (!this.ContainsKey(valueSet)) + if (!this.ContainsKey(valueSet) && (this.configuration?.IsValueSetAllowed(valueSet) ?? true)) { this.Add(valueSet, this.requirementStateOfComplianceCalculator.Calculate(valueSet, relationalExpression)); }