/// <summary> /// <para>Overrides the method, which binds the specified data source to this control. In this method the /// validation of the data to be binded is implemented</para> /// </summary> /// <param name="dataSource"> /// an instance of the IEnumerable. It contains the data elements to be binded to this control. Can not be null. /// Should not contain null elements. /// </param> /// <exception cref="ArgumentNullException">if datasource is null</exception> /// <exception cref="ArgumentException">if dataSource contains null elements</exception> /// <exception cref="BindDataInvalidException">if the binded data is invalid (not DateTime or string data type, /// has incorrect formatting for text string, and so on)</exception> protected override void PerformDataBinding(IEnumerable dataSource) { //Validate Helper.ValidateNotNull(dataSource, "dataSource"); //Bind data ItemValidator itemValidator = new ItemValidator(DisplayDateFormat); if (!itemValidator.Validate(dataSource)) { throw new BindDataInvalidException("Data could not be bound to the control."); } base.PerformDataBinding(dataSource); }
public void TestValidate1() { Assert.IsTrue(iv.Validate(valid2), "Wrong Validate implementation."); }