view SilverlightValidation/SilverlightValidation.Tests/ViewModels/UserViewModel_Constructor.cs @ 115:4de4e7829319

Working code, need to tidy up layout
author stevenh7776
date Sun, 20 May 2012 15:50:37 +0100
parents 11994ccdc50b
children
line wrap: on
line source

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SilverlightValidation.Models;
using SilverlightValidation.Validators;
using SilverlightValidation.ViewModels;

namespace SilverlightValidation.Tests.ViewModels
{
    [TestClass]
    public class UserViewModel_Constructor
    {
        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void WhenConstructed_WithTwoNulls_ThenThrowsArgumentNullException()
        {
            new UserViewModel(null, null);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void WhenConstructed_WithNullFirstParam_ThenThrowsArgumentNullException()
        {
            new UserViewModel(null, UserModelValidator.Create());
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void WhenConstructed_WithNullSecondParam_ThenThrowsArgumentNullException()
        {
            new UserViewModel(UserModel.Create(), null);
        }

        [TestMethod]
        public void WhenConstructed_WithGenericParams_ThenInstantiatesViewModel()
        {
            var vm = new UserViewModel(UserModel.Create(), UserModelValidator.Create());
            Assert.IsNotNull(vm);
        }
    }
}