public override void Validate(object context)
        {
            Utility.VerifyNonNull("ClaimProperty", this.ClaimProperty);
            Utility.VerifyNonNull("ConditionTag", this.ConditionTag);
            this.ClaimProperty.Validate();
            SelectionRule selectionRule = context as SelectionRule;

            if (selectionRule != null)
            {
                IEnumerator <SelectionCondition> enumerator = selectionRule.Conditions.GetEnumerator();
                using (enumerator)
                {
                    while (enumerator.MoveNext())
                    {
                        SelectionCondition current = enumerator.Current;
                        if (StringComparer.OrdinalIgnoreCase.Compare(this.ConditionTag, current.ConditionTag) != 0)
                        {
                            continue;
                        }
                        return;
                    }
                    object[] conditionTag = new object[1];
                    conditionTag[0] = this.ConditionTag;
                    throw new PolicyValidationException(SR.GetString("POLICY0025", conditionTag));
                }
                return;
            }
            else
            {
                object[] str = new object[1];
                str[0] = context.GetType().ToString();
                throw new PolicyValidationException(SR.GetString("POLICY0015", str));
            }
        }
Example #2
0
 public virtual bool Compare(SelectionCondition other)
 {
     if (other != null)
     {
         if (StringComparer.OrdinalIgnoreCase.Equals(this.ConditionTag, other.ConditionTag))
         {
             if (this.Conditions.Count == other.Conditions.Count)
             {
                 int num = 0;
                 while (num < this.Conditions.Count)
                 {
                     if (this.Conditions[num].Compare(other.Conditions[num]))
                     {
                         num++;
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Example #3
0
		public virtual bool Compare(SelectionCondition other)
		{
			if (other != null)
			{
				if (StringComparer.OrdinalIgnoreCase.Equals(this.ConditionTag, other.ConditionTag))
				{
					if (this.Conditions.Count == other.Conditions.Count)
					{
						int num = 0;
						while (num < this.Conditions.Count)
						{
							if (this.Conditions[num].Compare(other.Conditions[num]))
							{
								num++;
							}
							else
							{
								return false;
							}
						}
						return true;
					}
					else
					{
						return false;
					}
				}
				else
				{
					return false;
				}
			}
			else
			{
				return false;
			}
		}
Example #4
0
		private void HandleSelConditionBody__OSQBRACKET_OptCondList_CSQBRACKET()
		{
			if (this._policyObjects.Count != 0)
			{
				Collection<ClaimCondition> claimConditions = this._policyObjects.Peek() as Collection<ClaimCondition>;
				if (claimConditions != null)
				{
					this._policyObjects.Pop();
					SelectionCondition selectionCondition = new SelectionCondition();
					foreach (ClaimCondition claimCondition in claimConditions)
					{
						selectionCondition.Conditions.Add(claimCondition);
					}
					this._policyObjects.Push(selectionCondition);
					return;
				}
				else
				{
					object[] objArray = new object[1];
					objArray[0] = "Collection<ClaimCondition>";
					throw new InvalidOperationException(SR.GetString("POLICY0037", objArray));
				}
			}
			else
			{
				throw new InvalidOperationException(SR.GetString("POLICY0038", new object[0]));
			}
		}