예제 #1
0
        /// <summary>
        /// Update the values, formula and switch of the provided <see cref="ParameterOverrideValueSet"/>
        /// </summary>
        /// <param name="clone">
        /// The clone of the <see cref="ParameterOverrideValueSet"/> that is to be updated.
        /// </param>
        /// <param name="valueSetValues">
        /// The <see cref="ValueSetValues"/> used to update the <see cref="ParameterOverrideValueSet"/> clone with
        /// </param>
        private void UpdateClone(ParameterOverrideValueSet clone, ValueSetValues valueSetValues)
        {
            try
            {
                clone.Manual[valueSetValues.ComponentIndex] = valueSetValues.ManualValue;
            }
            catch (ArgumentOutOfRangeException)
            {
                clone.ResetManual();
                clone.Manual[valueSetValues.ComponentIndex] = valueSetValues.ManualValue;
            }
            catch (Exception exception)
            {
                throw exception;
            }

            try
            {
                clone.Computed[valueSetValues.ComponentIndex] = valueSetValues.ComputedValue;
            }
            catch (ArgumentOutOfRangeException)
            {
                clone.ResetComputed();
                clone.Computed[valueSetValues.ComponentIndex] = valueSetValues.ComputedValue;
            }
            catch (Exception exception)
            {
                throw exception;
            }

            try
            {
                clone.Formula[valueSetValues.ComponentIndex] = valueSetValues.FormulaValue;
            }
            catch (ArgumentOutOfRangeException)
            {
                clone.ResetFormula();
                clone.Formula[valueSetValues.ComponentIndex] = valueSetValues.FormulaValue;
            }
            catch (Exception exception)
            {
                throw exception;
            }

            try
            {
                clone.Reference[valueSetValues.ComponentIndex] = valueSetValues.ReferenceValue;
            }
            catch (ArgumentOutOfRangeException)
            {
                clone.ResetReference();
                clone.Reference[valueSetValues.ComponentIndex] = valueSetValues.ReferenceValue;
            }
            catch (Exception exception)
            {
                throw exception;
            }

            clone.ValueSwitch = valueSetValues.SwitchKind;
        }
        public void Verify_that_Formula_Value_can_be_reset()
        {
            var defaultValueArray = new ValueArray <string>(new List <string> {
                "-"
            });

            var parameterOverrideValueSet = new ParameterOverrideValueSet(Guid.NewGuid(), null, null);

            parameterOverride.ValueSet.Add(parameterOverrideValueSet);

            parameterOverrideValueSet.ResetFormula();
            Assert.AreEqual(defaultValueArray, parameterOverrideValueSet.Formula);

            parameterOverrideValueSet.ResetFormula();
            Assert.AreEqual(defaultValueArray, parameterOverrideValueSet.Formula);
        }