Esempio n. 1
0
		public void Deny_Unrestricted ()
		{
			ValidatorCollection vc = new ValidatorCollection ();

			Assert.AreEqual (0, vc.Count, "Count");
			Assert.IsFalse (vc.IsReadOnly, "IsReadOnly");
			Assert.IsFalse (vc.IsSynchronized, "IsSynchronized");
			Assert.IsNotNull (vc.SyncRoot, "SyncRoot");

			vc.Add (null);
			Assert.IsNull (vc[0], "this[int]");
			Assert.IsTrue (vc.Contains (null), "Contains");
			Assert.IsNotNull (vc.GetEnumerator (), "GetEnumerator");
			vc.Remove (null);

			IValidator validator = new CustomValidator ();
			vc.Add (validator);
			vc.CopyTo (new IValidator[1], 0);
		}
Esempio n. 2
0
	public ValidatorCollection GetValidators (string validationGroup)
	{			
		if (validationGroup == String.Empty)
			validationGroup = null;

		ValidatorCollection col = new ValidatorCollection ();
		if (_validators == null)
			return col;
		
		foreach (IValidator v in _validators)
			if (BelongsToGroup(v, validationGroup))
				col.Add(v);

		return col;
	}
 public ValidatorCollection GetValidators(string validationGroup)
 {
     if (validationGroup == null)
     {
         validationGroup = string.Empty;
     }
     ValidatorCollection validators = new ValidatorCollection();
     if (this._validators != null)
     {
         for (int i = 0; i < this.Validators.Count; i++)
         {
             BaseValidator validator = this.Validators[i] as BaseValidator;
             if (validator != null)
             {
                 if (string.Compare(validator.ValidationGroup, validationGroup, StringComparison.Ordinal) == 0)
                 {
                     validators.Add(validator);
                 }
             }
             else if (validationGroup.Length == 0)
             {
                 validators.Add(this.Validators[i]);
             }
         }
     }
     return validators;
 }