public void Ctor_Bool(bool password) { var attribute = new PasswordPropertyTextAttribute(password); Assert.Equal(password, attribute.Password); Assert.Equal(!password, attribute.IsDefaultAttribute()); }
public void Ctor_Default() { var attribute = new PasswordPropertyTextAttribute(); Assert.False(attribute.Password); Assert.True(attribute.IsDefaultAttribute()); }
public void Equals_Object_ReturnsExpected(PasswordPropertyTextAttribute attribute, object other, bool expected) { Assert.Equal(expected, attribute.Equals(other)); if (other is PasswordPropertyTextAttribute) { Assert.Equal(expected, attribute.GetHashCode().Equals(other.GetHashCode())); } }
public void No_Get_ReturnsExpected() { PasswordPropertyTextAttribute attribute = PasswordPropertyTextAttribute.No; Assert.Same(attribute, PasswordPropertyTextAttribute.No); Assert.False(attribute.Password); Assert.True(attribute.IsDefaultAttribute()); }
/* ItemName : url : Login : password : e-mail : question secrete : réponse */ public Account(string itemName, string email, PasswordPropertyTextAttribute password, UrlAttribute url = null, string question = "", string answer = "") { ItemName = itemName; Url = url; Password = password; Email = email; Question = question; Answer = answer; }
private void OnCustomRecordCellEdit(object sender, GetCustomRowCellEditEventArgs e) { PropertyGridControl control = (PropertyGridControl)sender; MemberInfo[] mi = control.SelectedObject.GetType().GetMember(e.Row.Properties.FieldName); PasswordPropertyTextAttribute attr = (PasswordPropertyTextAttribute)Attribute.GetCustomAttribute(mi[0], typeof(PasswordPropertyTextAttribute)); if (attr != null && attr.Password) { e.RepositoryItem = passwordEdit; } }
public override void Initialize(object owner, object value) { PropertyGridItem data = (owner as PropertyGridItemElement).Data as PropertyGridItem; PasswordPropertyTextAttribute attribute = data.Attributes[typeof(PasswordPropertyTextAttribute)] as PasswordPropertyTextAttribute; if (attribute != null && attribute.Password) { ((RadTextBoxElement)this.EditorElement).PasswordChar = '*'; } else { ((RadTextBoxElement)this.EditorElement).PasswordChar = char.MinValue; } base.Initialize(owner, value); ((RadTextBoxElement)this.EditorElement).TextBoxItem.ReadOnly = !data.TypeConverter.CanConvertFrom(typeof(string)); }
public static IEnumerable <object[]> Equals_TestData() { var attribute = new PasswordPropertyTextAttribute(true); yield return(new object[] { attribute, attribute, true }); yield return(new object[] { attribute, new PasswordPropertyTextAttribute(true), true }); yield return(new object[] { attribute, new PasswordPropertyTextAttribute(false), false }); yield return(new object[] { new PasswordPropertyTextAttribute(false), new PasswordPropertyTextAttribute(false), true }); yield return(new object[] { new PasswordPropertyTextAttribute(false), new PasswordPropertyTextAttribute(true), false }); yield return(new object[] { attribute, new object(), false }); yield return(new object[] { attribute, null, false }); }
static PasswordPropertyTextAttribute () { No = new PasswordPropertyTextAttribute (false); Yes = new PasswordPropertyTextAttribute (true); Default = No; }
static PasswordPropertyTextAttribute() { No = new PasswordPropertyTextAttribute(false); Yes = new PasswordPropertyTextAttribute(true); Default = No; }