Mercurial > silverbladetech
comparison SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModelFixture.cs @ 106:62477c2e8837
Command tests
author | stevenhollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sun, 06 May 2012 13:00:46 +0100 |
parents | db05a55e3536 |
children | 572886951353 |
comparison
equal
deleted
inserted
replaced
105:1c9fc59af186 | 106:62477c2e8837 |
---|---|
169 Assert.IsTrue(vm.IsChanged); | 169 Assert.IsTrue(vm.IsChanged); |
170 } | 170 } |
171 | 171 |
172 #endregion | 172 #endregion |
173 | 173 |
174 #region Commands | |
175 | |
176 [Test] | |
177 public void WhenNewViewModel_ThenOkCommandIsExecutable() | |
178 { | |
179 // arrange | |
180 var vm = CreateDefaultUserViewModel(); | |
181 | |
182 // assert | |
183 Assert.IsTrue(vm.OkCommand.CanExecute(null)); | |
184 } | |
185 | |
186 [Test] | |
187 public void WhenNewViewModel_ThenCancelCommandIsExecutable() | |
188 { | |
189 // arrange | |
190 var vm = CreateDefaultUserViewModel(); | |
191 | |
192 // assert | |
193 Assert.IsTrue(vm.CancelCommand.CanExecute(null)); | |
194 } | |
195 | |
196 [Test] | |
197 public void WhenNewViewModel_WithCancelExecuted_ThenShouldRaiseEvent() | |
198 { | |
199 // arrange | |
200 var vm = CreateDefaultUserViewModel(); | |
201 | |
202 // act | |
203 vm.CancelCommand.Execute(null); | |
204 | |
205 // assert | |
206 vm.ShouldRaise("UserViewResponseMessage"); | |
207 } | |
208 | |
209 #endregion | |
210 | |
174 #region Helpers | 211 #region Helpers |
175 | 212 |
176 private static UserViewModel CreateDefaultUserViewModel() | 213 private static UserViewModel CreateDefaultUserViewModel() |
177 { | 214 { |
178 var vm = new UserViewModel(UserModel.Create(), UserModelValidatorFake.Create()); | 215 var vm = new UserViewModel(UserModel.Create(), UserModelValidatorFake.Create()); |