Skip to content

Instantly share code, notes, and snippets.

Created May 6, 2012 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2624197 to your computer and use it in GitHub Desktop.
Save anonymous/2624197 to your computer and use it in GitHub Desktop.
ViewModel.Constructor tests
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);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment