public NewItemModelBase() { this.dataErrorInfoSupport = new DataErrorInfoSupport(this); this.time = DateTime.Now; this.noticeBranch = string.Empty; this.notice = string.Empty; }
public void InvalidArgumentsTest() { AssertHelper.ExpectedException <ArgumentNullException>(() => new DataErrorInfoSupport(null)); DataErrorInfoSupport dataErrorInfoSupport = new DataErrorInfoSupport(new MockEntity()); string message; AssertHelper.ExpectedException <ArgumentException>(() => message = dataErrorInfoSupport["InvalidMember"]); }
public UriHelpViewModel(IUriHelpView view) : base(view) { this.dataErrorInfoSupport = new DataErrorInfoSupport(this); this.serverName = string.Empty; this.port = 8080; this.path = "tfs"; this.isHttpsProtocal = false; this.uriPreview = Resources.InvalidUrl; this.submitCommand = new DelegateCommand(() => Close(true), CanSubmitSetting); this.cancelCommand = new DelegateCommand(() => Close(false)); }
public void ValidateTest() { MockEntity mockEntity = new MockEntity(); DataErrorInfoSupport dataErrorInfoSupport = new DataErrorInfoSupport(mockEntity); Assert.AreEqual("The Firstname field is required.", dataErrorInfoSupport[nameof(MockEntity.Firstname)]); Assert.AreEqual("The Lastname field is required.", dataErrorInfoSupport[nameof(MockEntity.Lastname)]); Assert.AreEqual("", dataErrorInfoSupport[nameof(MockEntity.Email)]); Assert.AreEqual("The Firstname field is required." + Environment.NewLine + "The Lastname field is required.", dataErrorInfoSupport.Error); mockEntity.Firstname = "Harry"; mockEntity.Lastname = "Potter"; Assert.AreEqual("", dataErrorInfoSupport[nameof(MockEntity.Lastname)]); Assert.AreEqual("", dataErrorInfoSupport.Error); mockEntity.Email = "InvalidEmailAddress"; Assert.AreEqual("", dataErrorInfoSupport[nameof(MockEntity.Lastname)]); Assert.AreEqual(@"The field Email must match the regular expression '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$'.", dataErrorInfoSupport[nameof(MockEntity.Email)]); Assert.AreEqual(@"The field Email must match the regular expression '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$'.", dataErrorInfoSupport.Error); }
private void Initialize() { dataErrorInfoSupport = new DataErrorInfoSupport(this); }
public ValidationModel() { _dataErrorInfoSupport = new DataErrorInfoSupport(this); }
public AlertItem() { this.dataErrorInfoSupport = new DataErrorInfoSupport(this); }
public DialogViewModel(TView view) : base(view) { dataErrorInfoSupport = new DataErrorInfoSupport(this); }