public void BeepOnErrorTest() { MaskedTextBox mtb = new MaskedTextBox(); Assert.AreEqual(false, mtb.BeepOnError, "#A1"); mtb.BeepOnError = true; Assert.AreEqual(true, mtb.BeepOnError, "#A2"); mtb.BeepOnError = false; Assert.AreEqual(false, mtb.BeepOnError, "#A3"); mtb.Dispose(); }
public void AsciiOnlyTest() { MaskedTextBox mtb = new MaskedTextBox(); Assert.AreEqual(false, mtb.AsciiOnly, "#A1"); mtb.AsciiOnly = true; Assert.AreEqual(true, mtb.AsciiOnly, "#A2"); mtb.AsciiOnly = false; Assert.AreEqual(false, mtb.AsciiOnly, "#A3"); mtb.Dispose(); }
public void TextLengthTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(0, mtb.TextLength, "#T1"); mtb.Text = "abc"; Assert.AreEqual(3, mtb.TextLength, "#T2"); mtb.Dispose(); }
public void FormatProviderTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.IsNull(mtb.FormatProvider, "#F1"); mtb.FormatProvider = CultureInfo.CurrentCulture.NumberFormat; Assert.IsNotNull(mtb.FormatProvider, "#F2"); Assert.AreSame(CultureInfo.CurrentCulture.NumberFormat, mtb.FormatProvider, "#F3"); mtb.Dispose(); }
public void MultilineTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual (false, mtb.Multiline, "#M1"); mtb.Multiline = true; Assert.AreEqual (false, mtb.Multiline, "#M2"); mtb.Dispose (); }
public void HidePromptOnLeaveTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual (false, mtb.HidePromptOnLeave, "#H1"); mtb.HidePromptOnLeave = true; Assert.AreEqual (true, mtb.HidePromptOnLeave, "#H1"); mtb.Dispose (); }
public void PromptCharTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual ('_', mtb.PromptChar, "#P1"); mtb.PromptChar = '*'; Assert.AreEqual ('*', mtb.PromptChar, "#P2"); mtb.Dispose (); }
public void WordWrapTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(false, mtb.WordWrap, "#W1"); mtb.WordWrap = true; Assert.AreEqual(false, mtb.WordWrap, "#W2"); mtb.Dispose(); }
public void RejectInputOnFirstFailureTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual (false, mtb.RejectInputOnFirstFailure, "#R1"); mtb.RejectInputOnFirstFailure = true; Assert.AreEqual (true, mtb.RejectInputOnFirstFailure, "#R2"); mtb.Dispose (); }
public void ReadOnlyTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual (false, mtb.ReadOnly, "#R1"); mtb.ReadOnly = true; Assert.AreEqual (true, mtb.ReadOnly, "#R2"); mtb.Dispose (); }
public void ResetOnPromptTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual (true, mtb.ResetOnPrompt, "#R1"); mtb.ResetOnPrompt = false; Assert.AreEqual (false, mtb.ResetOnPrompt, "#R2"); mtb.Dispose (); }
public void SkipLiteralsTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual (true, mtb.SkipLiterals, "#S1"); mtb.SkipLiterals = false; Assert.AreEqual (false, mtb.SkipLiterals, "#S2"); mtb.Dispose (); }
public void UseSystemPasswordCharTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual (false, mtb.UseSystemPasswordChar, "#U1"); mtb.UseSystemPasswordChar = true; Assert.AreEqual (true, mtb.UseSystemPasswordChar, "#U2"); mtb.Dispose (); }
public void ValidatingTypeTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.IsNull(mtb.ValidatingType, "#V1"); mtb.ValidatingType = typeof(int); Assert.IsNotNull(mtb.ValidatingType, "#V2"); Assert.AreSame(typeof(int), mtb.ValidatingType, "#V3"); mtb.Dispose(); }
public void PasswordCharTest () { MaskedTextBox mtb; mtb = new MaskedTextBox (); Assert.AreEqual ('\0', mtb.PasswordChar, "#P1"); mtb.PasswordChar = '*'; Assert.AreEqual ('*', mtb.PasswordChar, "#P2"); mtb.Dispose (); }
public void AcceptsTabTest() { MaskedTextBox mtb = new MaskedTextBox(); Assert.AreEqual(false, mtb.AcceptsTab, "#A1"); mtb.AcceptsTab = true; Assert.AreEqual(false, mtb.AcceptsTab, "#A2"); mtb.AcceptsTab = false; Assert.AreEqual(false, mtb.AcceptsTab, "#A3"); mtb.Dispose(); }
public void AllowPromptAsInputTest() { MaskedTextBox mtb = new MaskedTextBox(); Assert.AreEqual(true, mtb.AllowPromptAsInput, "#A1"); mtb.AllowPromptAsInput = true; Assert.AreEqual(true, mtb.AllowPromptAsInput, "#A2"); mtb.AllowPromptAsInput = false; Assert.AreEqual(false, mtb.AllowPromptAsInput, "#A3"); mtb.Dispose(); }
private void GridDados_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { MaskedTextBox MaskCol = new MaskedTextBox(); if (e.ColumnIndex == 9) { MaskCol.Mask = "(00) 0000-0000"; MaskCol.Text = e.Value.ToString(); e.Value = MaskCol.Text; } MaskCol.Dispose(); }
public void MaskCompletedTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(true, mtb.MaskCompleted, "#M1"); mtb.Mask = "abcABCZZZ"; Assert.AreEqual(false, mtb.MaskCompleted, "#M2"); mtb.Text = "abcabcabc"; Assert.AreEqual(true, mtb.MaskCompleted, "#M3"); mtb.Dispose(); }
public void MaskFullTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(true, mtb.MaskFull, "#M1"); mtb.Mask = "abc"; Assert.AreEqual(false, mtb.MaskFull, "#M2"); mtb.Text = "abc"; Assert.AreEqual(true, mtb.MaskFull, "#M3"); mtb.Dispose(); }
public void SelectedTextTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual("", mtb.SelectedText, "#S1"); mtb.Text = "abc"; Assert.AreEqual("", mtb.SelectedText, "#S2"); mtb.SelectAll(); Assert.AreEqual("abc", mtb.SelectedText, "#S3"); mtb.Dispose(); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { if (MaskedTextBox != null) { UnmonitorControl(MaskedTextBox); MaskedTextBox.Dispose(); MaskedTextBox = null; } } base.Dispose(disposing); }
public void InsertKeyModeTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(InsertKeyMode.Default, mtb.InsertKeyMode, "#I1"); mtb.InsertKeyMode = InsertKeyMode.Insert; Assert.AreEqual(InsertKeyMode.Insert, mtb.InsertKeyMode, "#I2"); mtb.InsertKeyMode = InsertKeyMode.Overwrite; Assert.AreEqual(InsertKeyMode.Overwrite, mtb.InsertKeyMode, "#I3"); mtb.InsertKeyMode = InsertKeyMode.Default; Assert.AreEqual(InsertKeyMode.Default, mtb.InsertKeyMode, "#I4"); mtb.Dispose(); }
public void TextAlignTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(HorizontalAlignment.Left, mtb.TextAlign, "#T1"); mtb.TextAlign = HorizontalAlignment.Center; Assert.AreEqual(HorizontalAlignment.Center, mtb.TextAlign, "#T2"); mtb.TextAlign = HorizontalAlignment.Right; Assert.AreEqual(HorizontalAlignment.Right, mtb.TextAlign, "#T3"); mtb.TextAlign = HorizontalAlignment.Left; Assert.AreEqual(HorizontalAlignment.Left, mtb.TextAlign, "#T4"); mtb.Dispose(); }
public void LinesTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(0, mtb.Lines.Length, "#L1"); mtb.Text = "abc"; Assert.AreEqual(1, mtb.Lines.Length, "#L2"); Assert.AreEqual("abc", mtb.Lines [0], "#L2a"); mtb.Text = "abc\nabc"; Assert.AreEqual(2, mtb.Lines.Length, "#L3"); Assert.AreEqual("abc", mtb.Lines [0], "#L3a"); Assert.AreEqual("abc", mtb.Lines [1], "#L3b"); mtb.Dispose(); }
public void CutCopyMaskFormatTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(MaskFormat.IncludeLiterals, mtb.CutCopyMaskFormat, "#C1"); mtb.CutCopyMaskFormat = MaskFormat.ExcludePromptAndLiterals; Assert.AreEqual(MaskFormat.ExcludePromptAndLiterals, mtb.CutCopyMaskFormat, "#C2"); mtb.CutCopyMaskFormat = MaskFormat.IncludeLiterals; Assert.AreEqual(MaskFormat.IncludeLiterals, mtb.CutCopyMaskFormat, "#C3"); mtb.CutCopyMaskFormat = MaskFormat.IncludePrompt; Assert.AreEqual(MaskFormat.IncludePrompt, mtb.CutCopyMaskFormat, "#C4"); mtb.CutCopyMaskFormat = MaskFormat.IncludePromptAndLiterals; Assert.AreEqual(MaskFormat.IncludePromptAndLiterals, mtb.CutCopyMaskFormat, "#C5"); mtb.Dispose(); }
public void MaskTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual("", mtb.Mask, "#M1"); mtb.Mask = "abc"; Assert.AreEqual("abc", mtb.Mask, "#M2"); mtb.Mask = ""; Assert.AreEqual("", mtb.Mask, "#M3"); mtb.Mask = null; Assert.AreEqual("", mtb.Mask, "#M4"); mtb.Mask = ""; Assert.AreEqual("", mtb.Mask, "#M5"); mtb.Dispose(); }
public void TextTest2() { MaskedTextBox mtb; mtb = new MaskedTextBox(); mtb.Mask = "99 99"; mtb.Text = "23 34"; Assert.AreEqual("23 34", mtb.Text, "#T1"); mtb.RejectInputOnFirstFailure = true; mtb.Text = "23 34"; Assert.AreEqual("23 34", mtb.Text, "#T2"); mtb.Dispose(); }
public void TextMaskFormatTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); Assert.AreEqual(MaskFormat.IncludeLiterals, mtb.TextMaskFormat, "#T1"); mtb.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; Assert.AreEqual(MaskFormat.ExcludePromptAndLiterals, mtb.TextMaskFormat, "#T2"); mtb.TextMaskFormat = MaskFormat.IncludePromptAndLiterals; Assert.AreEqual(MaskFormat.IncludePromptAndLiterals, mtb.TextMaskFormat, "#T3"); mtb.TextMaskFormat = MaskFormat.IncludePrompt; Assert.AreEqual(MaskFormat.IncludePrompt, mtb.TextMaskFormat, "#T4"); mtb.TextMaskFormat = MaskFormat.IncludeLiterals; Assert.AreEqual(MaskFormat.IncludeLiterals, mtb.TextMaskFormat, "#T4"); mtb.Dispose(); }
public void UndoTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); mtb.Text = "abcdef"; Assert.AreEqual(false, mtb.CanUndo, "#A0-c"); mtb.Undo(); Assert.AreEqual("abcdef", mtb.Text, "#A1"); Assert.AreEqual(false, mtb.CanUndo, "#A1-c"); mtb.Text = "cdef"; mtb.ClearUndo(); Assert.AreEqual("cdef", mtb.Text, "#A2"); Assert.AreEqual(false, mtb.CanUndo, "#A2-c"); mtb.Dispose(); }