public void WhenUserRoleUpdateAddressHaveNoDomain_ShouldHaveError() { var validator = new UserRoleUpdateValidator(); #region Init variables string address = "test@address"; string roleName = "User"; #endregion UserRoleUpdate mailReadUpdate = new UserRoleUpdate { Address = address, RoleName = roleName }; var result = validator.TestValidate(mailReadUpdate); #region Tests result.ShouldHaveValidationErrorFor(x => x.Address); #endregion }
public void WhenUserRoleUpdateHaveWrongRole_ShouldHaveError() { var validator = new UserRoleUpdateValidator(); #region Init variables string address = "*****@*****.**"; string rolename = "WrongRole"; #endregion UserRoleUpdate mailReadUpdate = new UserRoleUpdate { Address = address, RoleName = rolename }; var result = validator.TestValidate(mailReadUpdate); #region Tests result.ShouldHaveValidationErrorFor(x => x.RoleName); #endregion }
public void WhenUserRoleUpdateIsOk_ShouldNotHaveAnyError() { var validator = new UserRoleUpdateValidator(); #region Init variables string address = "*****@*****.**"; string roleName = "User"; #endregion UserRoleUpdate mailReadUpdate = new UserRoleUpdate { Address = address, RoleName = roleName }; var result = validator.TestValidate(mailReadUpdate); #region Tests result.ShouldNotHaveAnyValidationErrors(); #endregion }