Пример #1
0
        public void Fail_if_the_count_is_zero()
        {
            NotEmptyExampleWithCollection example = new NotEmptyExampleWithCollection();

             List<string> list = new List<string>();
             // no elements in list!
             example.List = list;

             IList<ValidatonError> messages =
            _validator.Validate(new object[1] { example }, new Dictionary<string, IValidationAware>()).Errors;

             Assert.AreEqual(1, messages.Count);
        }
Пример #2
0
        public void Pass_if_the_count_is_one_or_more()
        {
            NotEmptyExampleWithCollection example = new NotEmptyExampleWithCollection();

             List<string> list = new List<string>();
             list.Add("one");

             example.List = list;

             IList<ValidatonError> messages =
            _validator.Validate(new object[1] { example }, new Dictionary<string, IValidationAware>()).Errors;

             Assert.AreEqual(0, messages.Count);
        }