public void GetValidationSummary_ExistingTag()
        {
            var viewModel = new TestViewModelWithValidationTags();

            viewModel.Validate();

            var summary = viewModel.GetValidationSummary(true, "PersonValidation");

            Assert.IsTrue(viewModel.HasErrors);
            Assert.IsNotNull(summary);
            Assert.AreEqual(2, summary.FieldErrors.Count);
        }
        public void GetValidationSummary_WithoutTagFiltering()
        {
            var viewModel = new TestViewModelWithValidationTags();

            viewModel.Validate();

            var summary = viewModel.GetValidationSummary(true);

            Assert.IsTrue(viewModel.HasErrors);
            Assert.IsNotNull(summary);
            Assert.AreEqual(2, summary.FieldErrors.Count);
        }
Пример #3
0
        public void ValidationToViewModel_NonExistingTag()
        {
            var viewModel = new TestViewModelWithValidationTags();

            viewModel.ValidateViewModel();

            var summary = viewModel.ValidationSummaryWithNonExistingTag;

            Assert.IsTrue(viewModel.HasErrors);
            Assert.IsNotNull(summary);
            Assert.AreEqual(0, summary.FieldErrors.Count);
        }
Пример #4
0
        public void ValidationToViewModel_ExistingTag()
        {
            var viewModel = new TestViewModelWithValidationTags();
            viewModel.ValidateViewModel();

            var summary = viewModel.PersonValidationSummary;

            Assert.IsTrue(viewModel.HasErrors);
            Assert.IsNotNull(summary);
            Assert.AreEqual(2, summary.FieldErrors.Count);  
        }
Пример #5
0
        public void ValidationToViewModel_WithoutTagFiltering()
        {
            var viewModel = new TestViewModelWithValidationTags();
            viewModel.ValidateViewModel();

            var summary = viewModel.ValidationSummaryWithoutTagFiltering;

            Assert.IsTrue(viewModel.HasErrors);
            Assert.IsNotNull(summary);
            Assert.AreEqual(2, summary.FieldErrors.Count);
        }