コード例 #1
0
ファイル: Rule.cs プロジェクト: nickchal/pash
		public virtual bool Compare(Rule other)
		{
			if (other != null)
			{
				if (this.Output == other.Output)
				{
					if (this.IssuanceStatement.Compare(other.IssuanceStatement))
					{
						return true;
					}
					else
					{
						return false;
					}
				}
				else
				{
					return false;
				}
			}
			else
			{
				return false;
			}
		}
コード例 #2
0
		public virtual void Validate(Rule context)
		{
			Utility.VerifyNonNull("ClaimProperty", this.ClaimProperty);
			Utility.VerifyNonNull("Expression", this.Expression);
			this.ClaimProperty.Validate();
			this.Expression.Validate(context);
		}
コード例 #3
0
ファイル: SelectionRule.cs プロジェクト: nickchal/pash
		public override bool Compare(Rule other)
		{
			SelectionRule selectionRule = other as SelectionRule;
			if (selectionRule != null)
			{
				if (this.Conditions.Count == selectionRule.Conditions.Count)
				{
					int num = 0;
					while (num < this.Conditions.Count)
					{
						if (this.Conditions[num].Compare(selectionRule.Conditions[num]))
						{
							num++;
						}
						else
						{
							return false;
						}
					}
					return base.Compare(other);
				}
				else
				{
					return false;
				}
			}
			else
			{
				return false;
			}
		}
コード例 #4
0
		public override void Validate(Rule context)
		{
			Utility.VerifyNonNullArgument("context", context);
			Utility.VerifyNonNull("ConditionTag", this.ConditionTag);
			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("POLICY0011", conditionTag));
				}
				return;
			}
			else
			{
				object[] str = new object[1];
				str[0] = context.GetType().ToString();
				throw new PolicyValidationException(SR.GetString("POLICY0001", str));
			}
		}
コード例 #5
0
ファイル: UnconditionalRule.cs プロジェクト: nickchal/pash
		public override bool Compare(Rule other)
		{
			UnconditionalRule unconditionalRule = other as UnconditionalRule;
			if (unconditionalRule != null)
			{
				return base.Compare(other);
			}
			else
			{
				return false;
			}
		}
コード例 #6
0
		public override void Validate(Rule context)
		{
			Utility.VerifyNonNullArgument("context", context);
			new Dictionary<string, object>(StringComparer.Ordinal);
			Dictionary<string, object> strs = new Dictionary<string, object>(StringComparer.Ordinal);
			foreach (ClaimPropertyAssignment claimPropertyAssignment in this.ClaimPropertyAssignments)
			{
				claimPropertyAssignment.Validate(context);
				//claimPropertyAssignment.ClaimProperty.PropertyType;
				string str = claimPropertyAssignment.ClaimProperty.PropertyType.ToString();
				if (!strs.ContainsKey(str))
				{
					strs.Add(str, null);
				}
				else
				{
					object[] objArray = new object[1];
					objArray[0] = str;
					throw new PolicyValidationException(SR.GetString("POLICY0009", objArray));
				}
			}
			if (strs.ContainsKey(ClaimPropertyType.Type.ToString()))
			{
				if (strs.ContainsKey(ClaimPropertyType.Value.ToString()))
				{
					return;
				}
				else
				{
					throw new PolicyValidationException(SR.GetString("POLICY0008", new object[0]));
				}
			}
			else
			{
				throw new PolicyValidationException(SR.GetString("POLICY0007", new object[0]));
			}
		}
コード例 #7
0
ファイル: IssuanceStatement.cs プロジェクト: nickchal/pash
		public abstract void Validate(Rule context);