Mercurial > silverbladetech
annotate SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModelTests.cs @ 97:1adc1ae981ea
Tests added to SilverlightValidation.Tests
author | stevenhollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sat, 05 May 2012 16:39:00 +0100 |
parents | 188f8b366e87 |
children | d0c2cac12376 |
rev | line source |
---|---|
97
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
1 using System; |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
2 using NUnit.Framework; |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
3 using SilverlightValidation.Models; |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
4 using SilverlightValidation.Validators; |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
5 using SilverlightValidation.ViewModels; |
96
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 |
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 namespace SilverlightValidation.Tests.ViewModels |
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 { |
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 [TestFixture] |
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 class UserViewModelTests |
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 { |
97
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
12 #region constructor tests |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
13 |
96
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 [Test] |
97
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
15 public void Constructor_WhenTwoNulls_ThenArgumentNullExceptionForModel() |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
16 { |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
17 Assert.Throws<ArgumentNullException>(() => new UserViewModel(null, null), "model"); |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
18 } |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
19 |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
20 [Test] |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
21 public void Constructor_WhenFirstParameterIsNull_ThenArgumentNullExceptionForModel() |
96
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 { |
97
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
23 Assert.Throws<ArgumentNullException>(() => new UserViewModel(null, new UserModelValidator()), "model"); |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
24 } |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
25 |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
26 [Test] |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
27 public void Constructor_WhenSecondParameterIsNull_ThenArgumentNullExceptionForValidator() |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
28 { |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
29 Assert.Throws<ArgumentNullException>(() => new UserViewModel(new UserModel(), null), "validator"); |
96
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 } |
97
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
31 |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
32 [Test] |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
33 public void DateOfBirth_WhenUpdated_ThenFiresPropertyChangeEvent() |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
34 { |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
35 var vm = new UserViewModel(new UserModel(), new UserModelValidator()); |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
36 var tester = new NotifyPropertyChangedTester(vm); |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
37 //tester.AssertChange(); |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
38 } |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
39 |
1adc1ae981ea
Tests added to SilverlightValidation.Tests
stevenhollidge <stevenhollidge@hotmail.com>
parents:
96
diff
changeset
|
40 #endregion |
96
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41 } |
188f8b366e87
Unit test project correctly setup as normal class library DLL.
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 } |