public void ValidParametersShouldReturnViewModel() { _AccountServices = new Mock<IAccountServices>(); _AccountServices.Setup(x => x.AccountsThatHavePreferences(SaleYear, STRAIN)) .Returns( new List<UserAccount> { new UserAccount { AccountNumber = "ACCOUNT1", User = new User { Username = "******", UserId = 1, EmailAddress = "*****@*****.**" } } } ); _SystemUnderTest = new AccountsController(_AccountServices.Object); StrainAccountsVM ans = _SystemUnderTest.Get(SaleYear, STRAIN); Assert.IsNotNull(ans); Assert.AreEqual(1, ans.Users.First().UserId); Assert.AreEqual(STRAIN, ans.Strain); Assert.AreEqual(SaleYear, ans.SaleYear); }
public void null_strain_should_() { _AccountServices = new Mock<IAccountServices>(); _AccountServices.Setup(x => x.AccountsThatHavePreferences(It.IsAny<int>(), It.IsAny<string>())) .Throws<ArgumentNullException>(); _SystemUnderTest = new AccountsController(_AccountServices.Object); StrainAccountsVM ans = _SystemUnderTest.Get(SaleYear, null); Assert.IsNull(ans); }