示例#1
0
        public NewItemModelBase()
        {
            this.dataErrorInfoSupport = new DataErrorInfoSupport(this);

            this.time         = DateTime.Now;
            this.noticeBranch = string.Empty;
            this.notice       = string.Empty;
        }
示例#2
0
        public void InvalidArgumentsTest()
        {
            AssertHelper.ExpectedException <ArgumentNullException>(() => new DataErrorInfoSupport(null));

            DataErrorInfoSupport dataErrorInfoSupport = new DataErrorInfoSupport(new MockEntity());
            string message;

            AssertHelper.ExpectedException <ArgumentException>(() => message = dataErrorInfoSupport["InvalidMember"]);
        }
示例#3
0
        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));
        }
示例#4
0
        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);
        }
示例#5
0
 private void Initialize()
 {
     dataErrorInfoSupport = new DataErrorInfoSupport(this);
 }
示例#6
0
 public ValidationModel()
 {
     _dataErrorInfoSupport = new DataErrorInfoSupport(this);
 }
示例#7
0
 public AlertItem()
 {
     this.dataErrorInfoSupport = new DataErrorInfoSupport(this);
 }
示例#8
0
 public AlertItem()
 {
     this.dataErrorInfoSupport = new DataErrorInfoSupport(this);
 }
示例#9
0
 public DialogViewModel(TView view)
     : base(view)
 {
     dataErrorInfoSupport = new DataErrorInfoSupport(this);
 }