public void NegativeValidation()
        {
            var target = new GreaterThanZeroTarget(-3);
            var notification = Validator.ValidateObject(target);
            Assert.IsFalse(notification.IsValid());

            var expected = new NotificationMessage("Amount", "Must be a positive number");
            Assert.AreEqual(expected, notification.AllMessages[0]);
            Assert.AreEqual(1, notification.AllMessages.Length);
        }
示例#2
0
 public void NotificationMessage_Has_An_Error_Severity_By_Default()
 {
     var message = new NotificationMessage("something", "else");
     message.Severity.ShouldEqual(Severity.Error);
 }
示例#3
0
 public bool Contains(NotificationMessage message)
 {
     return _list.Contains(message);
 }
示例#4
0
 public void Add(NotificationMessage message)
 {
     _list.Add(message);
 }