Mercurial > silverbladetech
diff 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 |
line wrap: on
line diff
--- a/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModelTests.cs Sat May 05 13:29:56 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModelTests.cs Sat May 05 16:39:00 2012 +0100 @@ -1,14 +1,42 @@ -using NUnit.Framework; +using System; +using NUnit.Framework; +using SilverlightValidation.Models; +using SilverlightValidation.Validators; +using SilverlightValidation.ViewModels; namespace SilverlightValidation.Tests.ViewModels { [TestFixture] class UserViewModelTests { + #region constructor tests + [Test] - public void Given_When_Then() + public void Constructor_WhenTwoNulls_ThenArgumentNullExceptionForModel() + { + Assert.Throws<ArgumentNullException>(() => new UserViewModel(null, null), "model"); + } + + [Test] + public void Constructor_WhenFirstParameterIsNull_ThenArgumentNullExceptionForModel() { - Assert.True(true); + Assert.Throws<ArgumentNullException>(() => new UserViewModel(null, new UserModelValidator()), "model"); + } + + [Test] + public void Constructor_WhenSecondParameterIsNull_ThenArgumentNullExceptionForValidator() + { + Assert.Throws<ArgumentNullException>(() => new UserViewModel(new UserModel(), null), "validator"); } + + [Test] + public void DateOfBirth_WhenUpdated_ThenFiresPropertyChangeEvent() + { + var vm = new UserViewModel(new UserModel(), new UserModelValidator()); + var tester = new NotifyPropertyChangedTester(vm); + //tester.AssertChange(); + } + + #endregion } }