changeset 110:0185b15e04ba

Test added for multi property validation
author stevenhollidge <stevenhollidge@hotmail.com>
date Sun, 06 May 2012 20:43:37 +0100
parents 11994ccdc50b
children 6cb8cd05ad6b
files SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel_INotifyDataErrorInfo.cs
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel_INotifyDataErrorInfo.cs	Sun May 06 20:37:32 2012 +0100
+++ b/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel_INotifyDataErrorInfo.cs	Sun May 06 20:43:37 2012 +0100
@@ -223,6 +223,10 @@
             // assert
             Assert.IsFalse(vm.HasErrors);
             vm.GetErrors("DateOfBirth").Should().BeNull();
+
+            vm.GetErrors("Username").Should().BeNull();
+            vm.GetErrors("Password").Should().BeNull();
+            vm.GetErrors("Email").Should().BeNull();
         }
 
         [TestMethod]
@@ -237,6 +241,10 @@
             // assert
             Assert.IsTrue(vm.HasErrors);
             vm.GetErrors("DateOfBirth").Should().HaveCount(1);
+
+            vm.GetErrors("Username").Should().BeNull();
+            vm.GetErrors("Password").Should().BeNull();
+            vm.GetErrors("Email").Should().BeNull();
         }
 
         [TestMethod]
@@ -251,6 +259,10 @@
             // assert
             Assert.IsTrue(vm.HasErrors);
             vm.GetErrors("DateOfBirth").Should().HaveCount(1);
+
+            vm.GetErrors("Username").Should().BeNull();
+            vm.GetErrors("Password").Should().BeNull();
+            vm.GetErrors("Email").Should().BeNull();
         }
 
         [TestMethod]
@@ -265,6 +277,28 @@
             // assert
             Assert.IsTrue(vm.HasErrors);
             vm.GetErrors("DateOfBirth").Should().HaveCount(1);
+
+            vm.GetErrors("Username").Should().BeNull();
+            vm.GetErrors("Password").Should().BeNull();
+            vm.GetErrors("Email").Should().BeNull();
+        }
+
+        [TestMethod]
+        public void WhenInvalidVM_ThenErrorsForUsernameAndPasswordAndEmailAndDateOfBirthEqualOneEach()
+        {
+            // arrange
+            var vm = Helper.CreateInvalidUserViewModel();
+
+            // act
+            vm.OkCommand.Execute(null);
+            
+            // assert
+            Assert.IsTrue(vm.HasErrors);
+            vm.GetErrors("Username").Should().HaveCount(1);
+            vm.GetErrors("Password").Should().HaveCount(1);
+            vm.GetErrors("Email").Should().HaveCount(1);
+            vm.GetErrors("DateOfBirth").Should().HaveCount(1);
+            vm.GetErrors("Description").Should().BeNull();
         }
 
     }