コード例 #1
0
 public void ShouldResetErrors()
 {
     var errors = new ErrorMessageStringCollection();
     errors.Add("Name", "Name can't be blank");
     errors.Clear("Name");
     Assert.IsFalse(errors.HasErrors);
 }
コード例 #2
0
 public void ShouldAccessMessagesWithKey()
 {
     var erros = new ErrorMessageStringCollection();
     erros.Add("Name", "Name can't be blank");
     erros.Add("Name", "Name can't be empty");
     Assert.AreEqual("Name can't be blank\nName can't be empty", erros["Name"]);
 }
コード例 #3
0
 public void ShouldClearMessagesWithKey()
 {
     var errors = new ErrorMessageStringCollection();
     errors.Add("Name", "Name can't be blank");
     errors.Add("Name", "Name can't be empty");
     errors.Clear("Name");
     Assert.IsNull(errors["Name"]);
 }
コード例 #4
0
 public void ShouldStringContainMessages()
 {
     var erros = new ErrorMessageStringCollection();
     erros.Add("Name", "Name can't be blank");
     Assert.AreEqual("Name can't be blank", (string)erros);
 }
コード例 #5
0
 public void ShouldNotHaveErrors()
 {
     var errors = new ErrorMessageStringCollection();
     Assert.IsFalse(errors.HasErrors);
 }
コード例 #6
0
 public void ShouldHaveErrors()
 {
     var errors = new ErrorMessageStringCollection();
     errors.Add("Name", "Name can't be blank");
     Assert.IsTrue(errors.HasErrors);
 }
コード例 #7
0
 public void ShouldAddMessageWithKey()
 {
     var erros = new ErrorMessageStringCollection();
     erros.Add("Name", "Name can't be blank");
     Assert.Pass();
 }