public CustomerValidator(Customer customer) { _customer = customer; _titleProperty=PropertySupport.ExtractPropertyName(() => _customer.Title); _firstNameProperty = PropertySupport.ExtractPropertyName(() => _customer.FirstName); _lastNameProperty = PropertySupport.ExtractPropertyName(() => _customer.LastName); }
public void TestTitleError() { var cust=new Customer(); var errorInfo=cust as System.ComponentModel.IDataErrorInfo; Assert.IsTrue(String.IsNullOrWhiteSpace(errorInfo["Title"])); cust.Title="error"; Assert.IsFalse(String.IsNullOrWhiteSpace(errorInfo["Title"])); }
private void _InitModel() { _model = new Customer(); _model.PropertyChanged += _model_PropertyChanged; _model.DefaultAddress.PropertyChanged += DefaultAddress_PropertyChanged; _model.InvoiceAddress.PropertyChanged += DefaultAddress_PropertyChanged; _model.DeliveryAddress.PropertyChanged += DefaultAddress_PropertyChanged; bsCustomer.DataSource = _model; _SerializeModel(); }