Beispiel #1
0
        public void AbstractViewModel_as_INotifyDataErrorInfo_with_validation_service_invalid_property_not_validated_is_valid_even_if_called_multiple_times()
        {
            var sut = new SampleTestViewModel();

            sut.ValidateUsing(
                new DataAnnotationValidationService <SampleTestViewModel>(sut));

            var errors = sut.GetErrors("NotNullNotEmpty").OfType <Object>();

            errors = sut.GetErrors("NotNullNotEmpty").OfType <Object>();
            errors = sut.GetErrors("NotNullNotEmpty").OfType <Object>();

            Assert.AreEqual(0, errors.Count());
        }
Beispiel #2
0
        public void AbstractViewModel_PropertyChanged_is_raised_GetErrors_should_contain_expected_errors()
        {
            IEnumerable <Object> errors = null;

            var sut = new SampleTestViewModel();

            sut.PropertyChanged += (s, e) =>
            {
                errors = sut.GetErrors("NotNullNotEmpty").OfType <Object>();
            };

            sut.ValidateUsing(
                new DataAnnotationValidationService <SampleTestViewModel>(sut));
            sut.NotNullNotEmpty = "";

            Assert.IsNotNull(errors);
            Assert.AreEqual(0, errors.Count());
        }