VerifyString() public method

Verifies the test string against the mask.
public VerifyString ( string input ) : bool
input string
return bool
コード例 #1
0
 /// <summary>
 /// Check if the received string value matches with the Introduction Mask for DateTime datatype.
 /// </summary>
 /// <param name="stringValue">String to be checked.</param>
 /// <returns>Returns true if the string matches with Introduction Mask.</returns>
 private bool IsValidDateTimeAccordingMask(string stringValue)
 {
     bool result = true;
     if (mMask != string.Empty)
     {
         MaskedTextProvider maskTextProvider = new MaskedTextProvider(ConvertMask2DisplayMask(mMask));
         result = maskTextProvider.VerifyString(stringValue);
     }
     return result;
 }
コード例 #2
0
		public void VerifyString_string_int_MaskedTextResultHintTest00010 ()
		{
			MaskedTextProvider mtp;
			int Int32_out = 0;
			MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
			mtp = new MaskedTextProvider (@"abc");
			mtp.Add (@"a");
			mtp.Add ('\x61');
			mtp.Add ('\x61', out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (false, mtp.VerifyString (@"a longer string value", out Int32_out, out MaskedTextResultHint_out), "#12");
			Assert.AreEqual (MaskedTextResultHint.UnavailableEditPosition, MaskedTextResultHint_out, "#13");
			Assert.AreEqual (3, Int32_out, "#14");
			MaskedTextProviderTest.AssertProperties (mtp, "VerifyString_string_int_MaskedTextResultHintTest", 15, true, false, 1, 0, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, 0, 3, @"abc", true, true, '\x0', '\x5F', true, true, true, @"abc", @"abc", @"abc", @"abc", @"a", @"abc", @"a");
		}
コード例 #3
0
 /// <summary>
 /// Check if the received string value matches with the Introduction Mask for String datatype.
 /// </summary>
 /// <param name="stringValue">String to be checked.</param>
 /// <returns>Returns true if the received string matches with Introduction Mask.</returns>
 private bool IsValidStringAccordingMask(string stringValue)
 {
     bool result = true;
     if (Mask != string.Empty)
     {
         MaskedTextProvider maskTextProvider = new MaskedTextProvider(Mask);
         maskTextProvider.IncludeLiterals = false;
         maskTextProvider.Set(stringValue);
         result = maskTextProvider.VerifyString(stringValue) && maskTextProvider.MaskCompleted;
     }
     return result;
 }
コード例 #4
0
		public void VerifyString_string_int_MaskedTextResultHintTest00007 ()
		{
			MaskedTextProvider mtp;
			int Int32_out = 0;
			MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
			mtp = new MaskedTextProvider (@"abc");
			mtp.Add (@"a");
			mtp.Add ('\x61');
			mtp.Add ('\x61', out Int32_out, out MaskedTextResultHint_out);
			Assert.AreEqual (true, mtp.VerifyString (@"a", out Int32_out, out MaskedTextResultHint_out), "#0");
			Assert.AreEqual (MaskedTextResultHint.NoEffect, MaskedTextResultHint_out, "#1");
			Assert.AreEqual (0, Int32_out, "#2");
			MaskedTextProviderTest.AssertProperties (mtp, "VerifyString_string_int_MaskedTextResultHintTest", 3, true, false, 1, 0, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, 0, 3, @"abc", true, true, '\x0', '\x5F', true, true, true, @"abc", @"abc", @"abc", @"abc", @"a", @"abc", @"a");
		}
コード例 #5
0
 /// <summary>
 /// Checks if the editor has value or not.
 /// </summary>
 /// <returns>Return true if the editor has a value.</returns>
 private bool HasValue()
 {
     bool lResult = true;
     if (Mask != null && !Mask.Equals(string.Empty))
     {
         // Only String and Time data types can have masks in this Presentation. Check them separately.
         if (mDataType == ModelType.Time)
         {
             // Get the Time value without Time separators in order to check if the editor control has value.
             string lAuxStringValue = mMaskedTextBoxIT.Text.Replace(mMaskedTextBoxIT.Culture.DateTimeFormat.TimeSeparator, "");
             lResult = !string.IsNullOrEmpty(lAuxStringValue.Trim());
         }
         else
         {
             // String data type.
             MaskedTextProvider maskTextProvider = new MaskedTextProvider(Mask);
             maskTextProvider.IncludeLiterals = false;
             if (!maskTextProvider.VerifyString(mMaskedTextBoxIT.Text))
             {
                 // If the value assigned to the control does not satisfies the mask,
                 // check if the editor control Text has value.
                 lResult = (mMaskedTextBoxIT.Text != string.Empty);
             }
             else
             {
                 // If the value assigned satisfies the mask
                 // (it is not mandatory that the mask has been completed),
                 // assign the value to the MaskTextProvider and then check if
                 // it has value.
                 maskTextProvider.Set(mMaskedTextBoxIT.Text);
                 string auxString = maskTextProvider.ToString(false, false);
                 lResult = !string.IsNullOrEmpty(auxString);
             }
         }
     }
     else
     {
         lResult = !mMaskedTextBoxIT.Text.Equals(string.Empty);
     }
     return lResult;
 }