/// <summary> /// Validates that the conditional properties on the config object are correctly set. /// </summary> /// <exception cref="T:System.InvalidOperationException"/> /// <param name="config"></param> private static void ValidateConditional(IConditionalOperationConfig config) { if (config == null) { return; } int conditionsSet = 0; conditionsSet += config.Expected != null ? 1 : 0; conditionsSet += config.ExpectedState != null ? 1 : 0; conditionsSet += config.ConditionalExpression != null && config.ConditionalExpression.ExpressionStatement != null ? 1 : 0; if (conditionsSet > 1) { throw new InvalidOperationException("Only one of the conditonal properties Expected, ExpectedState and ConditionalExpression can be set."); } }
/// <summary> /// Validates that the conditional properties on the config object are correctly set. /// </summary> /// <exception cref="T:System.InvalidOperationException"/> /// <param name="config"></param> private static void ValidateConditional(IConditionalOperationConfig config) { if (config == null) return; int conditionsSet = 0; conditionsSet += config.Expected != null ? 1 : 0; conditionsSet += config.ExpectedState != null ? 1 : 0; conditionsSet += config.ConditionalExpression != null && config.ConditionalExpression.ExpressionStatement != null ? 1 : 0; if (conditionsSet > 1) throw new InvalidOperationException("Only one of the conditonal properties Expected, ExpectedState and ConditionalExpression can be set."); }