# HG changeset patch # User stevenhollidge # Date 1336333417 -3600 # Node ID 0185b15e04ba89f26bb726f8b3336852184d2622 # Parent 11994ccdc50b33b983229b7c8958ae1776dec727 Test added for multi property validation diff -r 11994ccdc50b -r 0185b15e04ba SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel_INotifyDataErrorInfo.cs --- 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(); } }