annotate SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel_INotifyDataErrorInfo.cs @ 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
rev   line source
109
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
1 using System;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
2 using FluentAssertions;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
3 using SilverlightValidation.Tests.Helpers;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
4 using Microsoft.VisualStudio.TestTools.UnitTesting;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
5
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
6 namespace SilverlightValidation.Tests.ViewModels
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
7 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8 [TestClass]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9 public class UserViewModel_INotifyDataErrorInfo
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12 public void WhenValidVM_WithUpdatedUsername_WithValidData_ThenErrorsForUsernameEmpty()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
13 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
14 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
15 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
16
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
17 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
18 var validData = "valid";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
19 vm.Username = validData;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
20
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
21 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
22 Assert.IsFalse(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
23 vm.GetErrors("Username").Should().BeNull();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
24 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
25
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
26 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
27 public void WhenValidVM_WithUpdatedUsername_WithInvalidEmptyData_ThenErrorsForUsernameEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
28 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
29 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
30 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
31
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
32 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
33 vm.Username = string.Empty;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
34
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
35 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
36 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
37 vm.GetErrors("Username").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
38 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
39
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
40 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
41 public void WhenValidVM_WithUpdatedUsername_WithInvalidShortData_ThenErrorsForUsernameEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
42 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
43 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
44 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
45
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
46 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
47 var shortData = "a";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
48 vm.Username = shortData;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
49
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
50 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
51 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
52 vm.GetErrors("Username").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
53 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
54
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
55 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
56 public void WhenValidVM_WithUpdatedUsername_WithInvalidLongData_ThenErrorsForUsernameEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
57 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
58 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
59 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
60
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
61 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
62 vm.Username = "thisdatashouldbetoolong";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
63
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
64 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
65 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
66 vm.GetErrors("Username").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
67 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
68
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
69 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
70 public void WhenValidVM_WithUpdatedPassword_WithValidData_ThenErrorsForPasswordEmpty()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
71 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
72 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
73 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
74
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
75 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
76 var validPassword = "Pa33word";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
77 vm.Password = validPassword;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
78
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
79 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
80 Assert.IsFalse(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
81 vm.GetErrors("Password").Should().BeNull();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
82 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
83
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
84 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
85 public void WhenValidVM_WithUpdatedPassword_WithInvalidEmptyData_ThenErrorsForPasswordEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
86 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
87 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
88 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
89
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
90 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
91 vm.Password = string.Empty;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
92
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
93 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
94 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
95 vm.GetErrors("Password").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
96 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
97
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
98 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
99 public void WhenValidVM_WithUpdatedPassword_WithInvalidDataNotContainingANumber_ThenErrorsForPasswordEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
100 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
101 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
102 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
103
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
104 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
105 vm.Password = "Password";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
106
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
107 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
108 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
109 vm.GetErrors("Password").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
110 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
111
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
112 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
113 public void WhenValidVM_WithUpdatedPassword_WithInvalidDataNotContainingAnUpperCaseLetter_ThenErrorsForPasswordEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
114 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
115 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
116 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
117
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
118 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
119 vm.Password = "pa33word";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
120
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
121 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
122 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
123 vm.GetErrors("Password").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
124 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
125
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
126 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
127 public void WhenValidVM_WithUpdatedPassword_WithInvalidDataNotContainingALowerCaseLetter_ThenErrorsForPasswordEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
128 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
129 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
130 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
131
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
132 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
133 vm.Password = "PA33WORD";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
134
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
135 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
136 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
137 vm.GetErrors("Password").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
138 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
139
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
140 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
141 public void WhenValidVM_WithUpdatedEmail_WithValidData_ThenErrorsForEmailEmpty()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
142 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
143 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
144 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
145
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
146 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
147 var validData = "valid@email.com";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
148 vm.Email = validData;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
149
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
150 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
151 Assert.IsFalse(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
152 vm.GetErrors("Email").Should().BeNull();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
153 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
154
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
155 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
156 public void WhenValidVM_WithUpdatedEmail_WithInvalidEmptyData_ThenErrorsForEmailEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
157 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
158 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
159 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
160
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
161 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
162 vm.Email = string.Empty;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
163
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
164 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
165 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
166 vm.GetErrors("Email").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
167 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
168
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
169 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
170 public void WhenValidVM_WithUpdatedEmail_WithInvalidDataNoAtSign_ThenErrorsForEmailEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
171 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
172 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
173 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
174
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
175 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
176 var noAtSign = "invalidemail.com";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
177 vm.Email = noAtSign;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
178
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
179 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
180 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
181 vm.GetErrors("Email").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
182 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
183
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
184 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
185 public void WhenValidVM_WithUpdatedEmail_WithInvalidDataNothingBeforeAtSign_ThenErrorsForEmailEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
186 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
187 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
188 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
189
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
190 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
191 var nothingBeforeAtSign = "@email.com";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
192 vm.Email = nothingBeforeAtSign;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
193
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
194 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
195 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
196 vm.GetErrors("Email").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
197 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
198
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
199 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
200 public void WhenValidVM_WithUpdatedEmail_WithInvalidDataNoDotAfterAtSign_ThenErrorsForEmailEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
201 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
202 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
203 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
204
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
205 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
206 vm.Email = "invalid@email";
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
207
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
208 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
209 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
210 vm.GetErrors("Email").Should().HaveCount(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
211 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
212
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
213 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
214 public void WhenValidVM_WithUpdatedDateOfBirth_WithValidData_ThenErrorsForDateOfBirthEmpty()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
215 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
216 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
217 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
218
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
219 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
220 var validData = new DateTime(1977, 01, 01);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
221 vm.DateOfBirth = validData;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
222
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
223 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
224 Assert.IsFalse(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
225 vm.GetErrors("DateOfBirth").Should().BeNull();
110
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
226
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
227 vm.GetErrors("Username").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
228 vm.GetErrors("Password").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
229 vm.GetErrors("Email").Should().BeNull();
109
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
230 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
231
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
232 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
233 public void WhenValidVM_WithUpdatedDateOfBirth_WithInvalidEarlyData_ThenErrorsForDateOfBirthEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
234 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
235 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
236 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
237
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
238 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
239 vm.DateOfBirth = DateTime.MinValue;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
240
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
241 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
242 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
243 vm.GetErrors("DateOfBirth").Should().HaveCount(1);
110
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
244
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
245 vm.GetErrors("Username").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
246 vm.GetErrors("Password").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
247 vm.GetErrors("Email").Should().BeNull();
109
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
248 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
249
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
250 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
251 public void WhenValidVM_WithUpdatedDateOfBirth_WithInvalidDataMaxDate_ThenErrorsForDateOfBirthEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
252 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
253 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
254 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
255
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
256 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
257 vm.DateOfBirth = DateTime.MaxValue;
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
258
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
259 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
260 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
261 vm.GetErrors("DateOfBirth").Should().HaveCount(1);
110
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
262
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
263 vm.GetErrors("Username").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
264 vm.GetErrors("Password").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
265 vm.GetErrors("Email").Should().BeNull();
109
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
266 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
267
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
268 [TestMethod]
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
269 public void WhenValidVM_WithUpdatedDateOfBirth_WithInvalidDataTomorrow_ThenErrorsForDateOfBirthEqualsOne()
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
270 {
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
271 // arrange
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
272 var vm = Helper.CreateValidUserViewModel();
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
273
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
274 // act
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
275 vm.DateOfBirth = DateTime.Now.AddDays(1);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
276
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
277 // assert
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
278 Assert.IsTrue(vm.HasErrors);
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
279 vm.GetErrors("DateOfBirth").Should().HaveCount(1);
110
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
280
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
281 vm.GetErrors("Username").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
282 vm.GetErrors("Password").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
283 vm.GetErrors("Email").Should().BeNull();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
284 }
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
285
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
286 [TestMethod]
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
287 public void WhenInvalidVM_ThenErrorsForUsernameAndPasswordAndEmailAndDateOfBirthEqualOneEach()
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
288 {
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
289 // arrange
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
290 var vm = Helper.CreateInvalidUserViewModel();
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
291
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
292 // act
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
293 vm.OkCommand.Execute(null);
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
294
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
295 // assert
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
296 Assert.IsTrue(vm.HasErrors);
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
297 vm.GetErrors("Username").Should().HaveCount(1);
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
298 vm.GetErrors("Password").Should().HaveCount(1);
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
299 vm.GetErrors("Email").Should().HaveCount(1);
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
300 vm.GetErrors("DateOfBirth").Should().HaveCount(1);
0185b15e04ba Test added for multi property validation
stevenhollidge <stevenhollidge@hotmail.com>
parents: 109
diff changeset
301 vm.GetErrors("Description").Should().BeNull();
109
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
302 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
303
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
304 }
11994ccdc50b First wave of tests complete
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
305 }