view 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 source

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 Constructor_WhenTwoNulls_ThenArgumentNullExceptionForModel()
        {
            Assert.Throws<ArgumentNullException>(() => new UserViewModel(null, null), "model");
        }

        [Test]
        public void Constructor_WhenFirstParameterIsNull_ThenArgumentNullExceptionForModel()
        {
            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
    }
}