Apim.DevOps.Toolkit.Core.Variables.VariableCollection.ContainsKey C# (CSharp) Method

ContainsKey() public method

public ContainsKey ( string variableKey ) : bool
variableKey string
return bool
		public bool ContainsKey(string variableKey)
		{
			return _variableCollection.ContainsKey(variableKey);
		}

Usage Example

Example #1
0
        private void Validate(string content, VariableCollection overridenVariableCollection)
        {
            var variableKeyMatches = Regex.Matches(content, _variableKeyRegexPattern);

            var validationFailed = false;

            foreach (Match variableKeyMatch in variableKeyMatches)
            {
                var variableKey = variableKeyMatch.Value;
                if (!overridenVariableCollection.ContainsKey(variableKey))
                {
                    validationFailed = true;
                    Console.Error.WriteLine($"There is no value defined for the variable {variableKey}");
                }
            }

            if (validationFailed)
            {
                throw new InvalidOperationException("There should be a value assigned to all variables");
            }
        }