public void Test_Account_Model_Validator_Valid_Account_Name() { Mock <IAccountRepositoryV5> repositoryMock = new Mock <IAccountRepositoryV5>(); AccountModelValiatorV5 valiator = new AccountModelValiatorV5(repositoryMock.Object); Account account = new Account(); account.DateCreated = DateTime.Now; account.SSN = "000-05-1120"; account.Name = "Test"; ValidationResultV5 result = valiator.Validate(account); Assert.True(result.Success); Assert.True(result.Message == string.Empty); }
public void Test_Account_Model_Validator_Empty_Account_Name() { Mock <IAccountRepositoryV5> repositoryMock = new Mock <IAccountRepositoryV5>(); AccountModelValiatorV5 valiator = new AccountModelValiatorV5(repositoryMock.Object); Account account = new Account(); account.DateCreated = DateTime.Now; account.SSN = "000-05-1120"; account.Name = string.Empty; ValidationResultV5 result = valiator.Validate(account); Assert.False(result.Success); Assert.Equal("Account name cannot be empty", result.Message); }
public void Test_Account_Model_Validator_Empty_SSN() { Mock <IAccountRepositoryV5> repositoryMock = new Mock <IAccountRepositoryV5>(); AccountModelValiatorV5 valiator = new AccountModelValiatorV5(repositoryMock.Object); Account account = new Account(); account.DateCreated = DateTime.Now; account.SSN = default(string); account.Name = "test"; ValidationResultV5 result = valiator.Validate(account); Assert.False(result.Success); Assert.Equal("Customer id cannot be empty", result.Message); }
public void Test_Account_Model_Validator_Account_Not_Exists() { Mock <IAccountRepositoryV5> repositoryMock = new Mock <IAccountRepositoryV5>(); repositoryMock.Setup(x => x.Exists(It.IsAny <string>())).Returns(false); AccountModelValiatorV5 valiator = new AccountModelValiatorV5(repositoryMock.Object); Account account = new Account(); account.DateCreated = DateTime.Now; account.SSN = "000-05-1120"; account.Name = "test"; ValidationResultV5 result = valiator.Validate(account); Assert.True(result.Success); Assert.Equal(string.Empty, result.Message); }