本文整理汇总了C#中System.ComponentModel.MaskedTextProvider.InsertAt方法的典型用法代码示例。如果您正苦于以下问题:C# MaskedTextProvider.InsertAt方法的具体用法?C# MaskedTextProvider.InsertAt怎么用?C# MaskedTextProvider.InsertAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ComponentModel.MaskedTextProvider
的用法示例。
在下文中一共展示了MaskedTextProvider.InsertAt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlaceCharCore
private bool PlaceCharCore( MaskedTextProvider provider, char ch, int startPosition, int length, bool overwrite, out int caretPosition )
{
caretPosition = startPosition;
if( startPosition < m_maskedTextProvider.Length )
{
MaskedTextResultHint notUsed;
if( length > 0 )
{
int endPosition = ( startPosition + length ) - 1;
return provider.Replace( ch, startPosition, endPosition, out caretPosition, out notUsed );
}
if( overwrite )
return provider.Replace( ch, startPosition, out caretPosition, out notUsed );
return provider.InsertAt( ch, startPosition, out caretPosition, out notUsed );
}
return false;
}
示例2: PlaceChar
/// <devdoc>
/// Override version to be able to perform the operation on a cloned provider.
/// </devdoc>
private bool PlaceChar(MaskedTextProvider provider, char ch, int startPosition, int length, bool overwrite,
out MaskedTextResultHint hint)
{
Debug.Assert( !this.flagState[IS_NULL_MASK], "This method must be called when a Mask is provided." );
this.caretTestPos = startPosition;
if (startPosition < this.maskedTextProvider.Length)
{
if (length > 0) // Replacing selection with input char.
{
int endPos = startPosition + length - 1;
return provider.Replace(ch, startPosition, endPos, out this.caretTestPos, out hint);
}
else
{
if (overwrite)
{
// overwrite character at next edit position from startPosition (inclusive).
return provider.Replace(ch, startPosition, out this.caretTestPos, out hint);
}
else // insert.
{
return provider.InsertAt(ch, startPosition, out this.caretTestPos, out hint);
}
}
}
hint = MaskedTextResultHint.UnavailableEditPosition;
return false;
}
示例3: Add_string_int_MaskedTextResultHint_Test00012
public void Add_string_int_MaskedTextResultHint_Test00012 ()
{
MaskedTextProvider mtp;
int testPosition;
MaskedTextResultHint resultHint;
bool result;
//int Int32_out = 0;
//MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"abc");
mtp.Add (@"a");
mtp.Remove ();
mtp.InsertAt ('\x61', 1);
result = mtp.Add (@"abc", out testPosition, out resultHint);
Assert.AreEqual (true, result, "Add_string_int_MaskedTextResultHint_Test#0");
Assert.AreEqual (MaskedTextResultHint.Success, resultHint, "Add_string_int_MaskedTextResultHint_Test#1");
Assert.AreEqual (2, testPosition, "Add_string_int_MaskedTextResultHint_Test#2");
MaskedTextProviderTest.AssertProperties (mtp, "Add_string_int_MaskedTextResultHint_Test", 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");
}
示例4: ToString_bool_bool_int_int_Test00008
public void ToString_bool_bool_int_int_Test00008 ()
{
MaskedTextProvider mtp;
//int Int32_out = 0;
//MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"abc");
mtp.Add (@"a");
mtp.Remove ();
mtp.InsertAt ('\x61', 1);
Assert.AreEqual (@"_", mtp.ToString (true, true, -1, 1), "#0");
MaskedTextProviderTest.AssertProperties (mtp, "ToString_bool_bool_int_int_Test", 1, true, false, 0, 1, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, -1, 3, @"abc", true, false, '\x0', '\x5F', true, true, true, @" bc", @" bc", @" bc", @"_bc", @"_", @" bc", @"");
}
示例5: ToString_PasswordTest
public void ToString_PasswordTest ()
{
MaskedTextProvider mtp;
mtp = new MaskedTextProvider ("####");
mtp.PasswordChar = '*';
Assert.AreEqual ("____", mtp.ToString (true, true, true, 0, mtp.Length), "#A1");
Assert.AreEqual ("____", mtp.ToString (false, true, true, 0, mtp.Length), "#A2");
mtp.Add ("314");
Assert.AreEqual ("314_", mtp.ToString (true, true, true, 0, mtp.Length), "#B1");
Assert.AreEqual ("***_", mtp.ToString (false, true, true, 0, mtp.Length), "#B2");
mtp.Clear ();
mtp.InsertAt ("666", 1);
Assert.AreEqual ("_666", mtp.ToString (true, true, true, 0, mtp.Length), "#C1");
Assert.AreEqual ("_***", mtp.ToString (false, true, true, 0, mtp.Length), "#C2");
}
示例6: ToString_False_FalseTest
public void ToString_False_FalseTest ()
{
MaskedTextProvider mtp;
mtp = new MaskedTextProvider ("a?a");
Assert.AreEqual ("", mtp.ToString (false, false), "#01");
mtp.InsertAt ('a', 1);
Assert.AreEqual (" a", mtp.ToString (false, false), "#02");
mtp = new MaskedTextProvider ("a?a");
Assert.AreEqual ("", mtp.ToString (false, false), "#03");
mtp.InsertAt ('a', 0);
Assert.AreEqual ("a", mtp.ToString (false, false), "#04");
mtp = new MaskedTextProvider ("a?a?a");
Assert.AreEqual ("", mtp.ToString (false, false), "#05");
mtp.InsertAt ('a', 3);
Assert.AreEqual (" a", mtp.ToString (false, false), "#06");
mtp = new MaskedTextProvider ("????a");
Assert.AreEqual ("", mtp.ToString (false, false), "#07");
mtp.InsertAt ('a', 3);
Assert.AreEqual (" a", mtp.ToString (false, false), "#08");
mtp = new MaskedTextProvider ("LLLLa");
Assert.AreEqual ("", mtp.ToString (false, false), "#09");
mtp.InsertAt ('a', 3);
Assert.AreEqual (" a", mtp.ToString (false, false), "#10");
mtp = new MaskedTextProvider ("CCCCa");
Assert.AreEqual ("", mtp.ToString (false, false), "#11");
mtp.InsertAt ('a', 3);
Assert.AreEqual (" a", mtp.ToString (false, false), "#12");
mtp = new MaskedTextProvider ("aaaaa");
Assert.AreEqual ("", mtp.ToString (false, false), "#13");
mtp.InsertAt ('a', 3);
Assert.AreEqual (" a", mtp.ToString (false, false), "#14");
mtp = new MaskedTextProvider ("aaaaaaaaaaaaaaaaaaaaaa");
Assert.AreEqual ("", mtp.ToString (false, false), "#15");
mtp.InsertAt ('a', 3);
Assert.AreEqual (" a", mtp.ToString (false, false), "#16");
mtp.InsertAt ('a', 9);
Assert.AreEqual (" a a", mtp.ToString (false, false), "#17");
mtp = new MaskedTextProvider ("aaa");
mtp.PasswordChar = '*';
mtp.InsertAt ('a', 2);
Assert.AreEqual (" a", mtp.ToString (false, false), "#18");
}
示例7: FindAssignedEditPositionInRangeTest12
public void FindAssignedEditPositionInRangeTest12 ()
{
MaskedTextProvider mtp;
//int Int32_out = 0;
//MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"000-00-0000");
mtp.Add (@"1");
mtp.Add (@"2");
mtp.InsertAt ('\x33', 7);
mtp.InsertAt ('\x34', 4);
MaskedTextProviderTest.AssertProperties (mtp, "FindAssignedEditPositionInRangeTest", 4115, true, false, 4, 5, CultureInfo.GetCultureInfo ("es-ES"), 9, true, false, false, 7, 11, @"000-00-0000", false, false, '\x0', '\x5F', true, true, true, @"12 -4 -3", @"12 -4 -3", @"12 -4 -3", @"12_-4_-3___", @"12_4_3___", @"12 -4 -3", @"12 4 3");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 0, false), "#3777");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 0, true), "#3778");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 1, false), "#3779");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 1, true), "#3780");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 2, false), "#3781");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 2, true), "#3782");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 3, false), "#3783");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 3, true), "#3784");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (0, 4, false), "#3785");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 4, true), "#3786");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (0, 5, false), "#3787");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 5, true), "#3788");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (0, 6, false), "#3789");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 6, true), "#3790");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (0, 7, false), "#3791");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 7, true), "#3792");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (0, 8, false), "#3793");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 8, true), "#3794");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (0, 9, false), "#3795");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 9, true), "#3796");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (0, 10, false), "#3797");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 10, true), "#3798");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (0, 11, false), "#3799");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 11, true), "#3800");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (0, 12, false), "#3801");
Assert.AreEqual (0, mtp.FindAssignedEditPositionInRange (0, 12, true), "#3802");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 0, false), "#3803");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 0, true), "#3804");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 1, false), "#3805");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 1, true), "#3806");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 2, false), "#3807");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 2, true), "#3808");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 3, false), "#3809");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 3, true), "#3810");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (1, 4, false), "#3811");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 4, true), "#3812");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (1, 5, false), "#3813");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 5, true), "#3814");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (1, 6, false), "#3815");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 6, true), "#3816");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (1, 7, false), "#3817");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 7, true), "#3818");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (1, 8, false), "#3819");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 8, true), "#3820");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (1, 9, false), "#3821");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 9, true), "#3822");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (1, 10, false), "#3823");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 10, true), "#3824");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (1, 11, false), "#3825");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 11, true), "#3826");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (1, 12, false), "#3827");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 12, true), "#3828");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 0, false), "#3829");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 0, true), "#3830");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 1, false), "#3831");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 1, true), "#3832");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 2, false), "#3833");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 2, true), "#3834");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 3, false), "#3835");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 3, true), "#3836");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 4, false), "#3837");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 4, true), "#3838");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 5, false), "#3839");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 5, true), "#3840");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 6, false), "#3841");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 6, true), "#3842");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (2, 7, false), "#3843");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 7, true), "#3844");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (2, 8, false), "#3845");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 8, true), "#3846");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (2, 9, false), "#3847");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 9, true), "#3848");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (2, 10, false), "#3849");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 10, true), "#3850");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (2, 11, false), "#3851");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 11, true), "#3852");
Assert.AreEqual (7, mtp.FindAssignedEditPositionInRange (2, 12, false), "#3853");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (2, 12, true), "#3854");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 0, false), "#3855");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 0, true), "#3856");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 1, false), "#3857");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 1, true), "#3858");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 2, false), "#3859");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 2, true), "#3860");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 3, false), "#3861");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 3, true), "#3862");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (3, 4, false), "#3863");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (3, 4, true), "#3864");
Assert.AreEqual (4, mtp.FindAssignedEditPositionInRange (3, 5, false), "#3865");
//.........这里部分代码省略.........
示例8: RemoveAtTest
public void RemoveAtTest ()
{
MaskedTextProvider mtp;
int Int32_out = 0;
MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
mtp.Add ("123456789");
mtp.RemoveAt (3, 6, out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (3, Int32_out, "#A1");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#A2");
MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_A", 1, true, false, 5, 7, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 4, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @"12389", @"12389", @"12389", @"12389_______", @"12389_______", @"12389", @"12389");
mtp = new MaskedTextProvider (@"La");
mtp.Add ("z1");
mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (0, Int32_out, "#B1");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#B2");
MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_B", 1, true, false, 0, 2, CultureInfo.GetCultureInfo ("es-ES"), 2, true, false, false, -1, 2, @"La", false, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"__", @"__", @"", @"");
mtp = new MaskedTextProvider (@"La");
mtp.Add ("z1");
mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (0, Int32_out, "#B1");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#B2");
MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_B", 1, true, false, 0, 2, CultureInfo.GetCultureInfo ("es-ES"), 2, true, false, false, -1, 2, @"La", false, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"__", @"__", @"", @"");
// Remove non-assigned character with assigned characters later on.
mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
mtp.InsertAt ("1", 1);
mtp.RemoveAt (0, 0, out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (0, Int32_out, "#C1");
Assert.AreEqual (MaskedTextResultHint.SideEffect, MaskedTextResultHint_out, "#C2");
MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_C", 1, true, false, 1, 11, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 0, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @"1", @"1", @"1", @"1___________", @"1___________", @"1", @"1");
// Remove assigned+non-assigned character with assigned characters later on.
mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
mtp.InsertAt ("1", 1);
mtp.InsertAt ("4", 4);
mtp.RemoveAt (1, 2, out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (1, Int32_out, "#D1");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#D2");
MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_D", 1, true, false, 1, 11, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 2, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @" 4", @" 4", @" 4", @"__4_________", @"__4_________", @" 4", @" 4");
// Remove non-assigned+assigned character with assigned characters later on.
mtp = new MaskedTextProvider (@"aaaaaaaaaaaa");
mtp.InsertAt ("1", 1);
mtp.InsertAt ("4", 4);
mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (0, Int32_out, "#E1");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#E2");
MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_E", 1, true, false, 1, 11, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 2, 12, @"aaaaaaaaaaaa", true, false, '\x0', '\x5F', true, true, true, @" 4", @" 4", @" 4", @"__4_________", @"__4_________", @" 4", @" 4");
// Remove 2 characters with a assigned character just after that cannot be removed 1 character.
mtp = new MaskedTextProvider (@"aaaLaaaaaaaa");
mtp.Add ("012Z4");
mtp.RemoveAt (0, 1, out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (0, Int32_out, "#F1");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "#F2");
MaskedTextProviderTest.AssertProperties (mtp, "RemoveAtTest_F", 1, true, false, 3, 9, CultureInfo.GetCultureInfo ("es-ES"), 12, true, false, false, 2, 12, @"aaaLaaaaaaaa", false, false, '\x0', '\x5F', true, true, true, @"2Z4", @"2Z4", @"2Z4", @"2Z4_________", @"2Z4_________", @"2Z4", @"2Z4");
}
示例9: FindAssignedEditPositionInRangeTest4
public void FindAssignedEditPositionInRangeTest4 ()
{
MaskedTextProvider mtp;
//int Int32_out = 0;
//MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"a?b?c");
mtp.Add ("a");
mtp.Remove ();
mtp.InsertAt ('\x61', 1);
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 0, false), "#201");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 0, true), "#202");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 1, false), "#203");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 1, true), "#204");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 2, false), "#205");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 2, true), "#206");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 3, false), "#207");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 3, true), "#208");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 4, false), "#209");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 4, true), "#210");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 5, false), "#211");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 5, true), "#212");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 6, false), "#213");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (0, 6, true), "#214");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 0, false), "#215");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 0, true), "#216");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 1, false), "#217");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 1, true), "#218");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 2, false), "#219");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 2, true), "#220");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 3, false), "#221");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 3, true), "#222");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 4, false), "#223");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 4, true), "#224");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 5, false), "#225");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 5, true), "#226");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 6, false), "#227");
Assert.AreEqual (1, mtp.FindAssignedEditPositionInRange (1, 6, true), "#228");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 0, false), "#229");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 0, true), "#230");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 1, false), "#231");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 1, true), "#232");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 2, false), "#233");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 2, true), "#234");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 3, false), "#235");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 3, true), "#236");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 4, false), "#237");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 4, true), "#238");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 5, false), "#239");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 5, true), "#240");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 6, false), "#241");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 6, true), "#242");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 0, false), "#243");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 0, true), "#244");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 1, false), "#245");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 1, true), "#246");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 2, false), "#247");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 2, true), "#248");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 3, false), "#249");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 3, true), "#250");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 4, false), "#251");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 4, true), "#252");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 5, false), "#253");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 5, true), "#254");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 6, false), "#255");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 6, true), "#256");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 0, false), "#257");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 0, true), "#258");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 1, false), "#259");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 1, true), "#260");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 2, false), "#261");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 2, true), "#262");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 3, false), "#263");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 3, true), "#264");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 4, false), "#265");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 4, true), "#266");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 5, false), "#267");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 5, true), "#268");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 6, false), "#269");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 6, true), "#270");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 0, false), "#271");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 0, true), "#272");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 1, false), "#273");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 1, true), "#274");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 2, false), "#275");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 2, true), "#276");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 3, false), "#277");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 3, true), "#278");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 4, false), "#279");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 4, true), "#280");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 5, false), "#281");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 5, true), "#282");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 6, false), "#283");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (5, 6, true), "#284");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (6, 0, false), "#285");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (6, 0, true), "#286");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (6, 1, false), "#287");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (6, 1, true), "#288");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (6, 2, false), "#289");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (6, 2, true), "#290");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (6, 3, false), "#291");
//.........这里部分代码省略.........
示例10: FindAssignedEditPositionInRangeTest2
public void FindAssignedEditPositionInRangeTest2 ()
{
MaskedTextProvider mtp;
//int Int32_out = 0;
//MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"abc");
mtp.Add ("a");
mtp.Remove ();
mtp.InsertAt ('\x61', 1);
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 0, false), "#51");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 0, true), "#52");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 1, false), "#53");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 1, true), "#54");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 2, false), "#55");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 2, true), "#56");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 3, false), "#57");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 3, true), "#58");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 4, false), "#59");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (0, 4, true), "#60");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 0, false), "#61");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 0, true), "#62");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 1, false), "#63");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 1, true), "#64");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 2, false), "#65");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 2, true), "#66");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 3, false), "#67");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 3, true), "#68");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 4, false), "#69");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (1, 4, true), "#70");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 0, false), "#71");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 0, true), "#72");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 1, false), "#73");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 1, true), "#74");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 2, false), "#75");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 2, true), "#76");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 3, false), "#77");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 3, true), "#78");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 4, false), "#79");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (2, 4, true), "#80");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 0, false), "#81");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 0, true), "#82");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 1, false), "#83");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 1, true), "#84");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 2, false), "#85");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 2, true), "#86");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 3, false), "#87");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 3, true), "#88");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 4, false), "#89");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (3, 4, true), "#90");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 0, false), "#91");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 0, true), "#92");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 1, false), "#93");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 1, true), "#94");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 2, false), "#95");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 2, true), "#96");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 3, false), "#97");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 3, true), "#98");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 4, false), "#99");
Assert.AreEqual (-1, mtp.FindAssignedEditPositionInRange (4, 4, true), "#100");
AssertProperties (mtp, "FindAssignedEditPositionInRangeTest", 101, true, false, 0, 1, CultureInfo.GetCultureInfo ("en-US"), 1, true, false, false, -1, 3, "abc", true, false, '\x0', '\x5F', true, true, true, @" bc", @" bc", @" bc", @"_bc", @"_", @" bc", @"");
}
示例11: InsertAt_charTest
public void InsertAt_charTest ()
{
MaskedTextProvider mtp;
int Int32_out = 0;
MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
// insert space over space
mtp = new MaskedTextProvider ("aaa");
mtp.Add (" ");
Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#A1");
Assert.AreEqual ("", mtp.ToString (), "A2");
Assert.AreEqual (0, Int32_out, "A3");
Assert.AreEqual (MaskedTextResultHint.CharacterEscaped, MaskedTextResultHint_out, "A4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_A", 1, true, false, 0, 3, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, -1, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"___", @"___", @"", @"");
// insert space over normal char.
mtp = new MaskedTextProvider ("aaa");
mtp.Add ("a");
Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#B1");
Assert.AreEqual (" a", mtp.ToString (), "B2");
Assert.AreEqual (0, Int32_out, "B3");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "B4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_B", 1, true, false, 1, 2, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 1, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @" a", @" a", @" a", @"_a_", @"_a_", @" a", @" a");
// insert space over empty position.
mtp = new MaskedTextProvider ("aaa");
Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#C1");
Assert.AreEqual ("", mtp.ToString (), "C2");
Assert.AreEqual (0, Int32_out, "C3");
Assert.AreEqual (MaskedTextResultHint.CharacterEscaped, MaskedTextResultHint_out, "C4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_C", 1, true, false, 0, 3, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, -1, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @"", @"", @"", @"___", @"___", @"", @"");
// insert space over empty position with other characters later in the string already inserted..
mtp = new MaskedTextProvider ("aaa");
mtp.InsertAt ('z', 2);
Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#D1");
Assert.AreEqual (" z", mtp.ToString (), "D2");
Assert.AreEqual (0, Int32_out, "D3");
Assert.AreEqual (MaskedTextResultHint.CharacterEscaped, MaskedTextResultHint_out, "D4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_D", 1, true, false, 1, 2, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 2, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @" z", @" z", @" z", @"__z", @"__z", @" z", @" z");
// insert space over non-empty position with other characters later in the string already inserted..
mtp = new MaskedTextProvider ("aaa");
mtp.InsertAt ('z', 0);
mtp.InsertAt ('z', 1);
Assert.AreEqual (true, mtp.InsertAt (' ', 0, out Int32_out, out MaskedTextResultHint_out), "#E1");
Assert.AreEqual (" zz", mtp.ToString (), "E2");
Assert.AreEqual (0, Int32_out, "E3");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "E4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_E", 1, true, false, 2, 1, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 2, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @" zz", @" zz", @" zz", @"_zz", @"_zz", @" zz", @" zz");
// Insert number over empty position with other characters later in the string.
mtp = new MaskedTextProvider (@"aaa");
mtp.InsertAt ('\x33', 2);
Assert.AreEqual (true, mtp.InsertAt ('\x34', 0, out Int32_out, out MaskedTextResultHint_out), "#F1");
Assert.AreEqual ("4 3", mtp.ToString (), "F2");
Assert.AreEqual (0, Int32_out, "F3");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "F4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_F", 1, true, false, 2, 1, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 2, 3, @"aaa", true, false, '\x0', '\x5F', true, true, true, @"4 3", @"4 3", @"4 3", @"4_3", @"4_3", @"4 3", @"4 3");
// insert space over literal with filled in positions later on (no more available edit positions)
mtp = new MaskedTextProvider ("aba");
mtp.InsertAt ('z', 0);
mtp.InsertAt ('z', 1);
mtp.InsertAt ('z', 2);
Assert.AreEqual (false, mtp.InsertAt (' ', 1, out Int32_out, out MaskedTextResultHint_out), "#F1");
Assert.AreEqual ("zbz", mtp.ToString (), "F2");
Assert.AreEqual (3, Int32_out, "F3");
Assert.AreEqual (MaskedTextResultHint.UnavailableEditPosition, MaskedTextResultHint_out, "F4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_F", 1, true, false, 2, 0, CultureInfo.GetCultureInfo ("es-ES"), 2, true, false, false, 2, 3, @"aba", true, true, '\x0', '\x5F', true, true, true, @"zbz", @"zbz", @"zbz", @"zbz", @"zz", @"zbz", @"zz");
// insert space over literal with filled in positions later on ( more available edit positions)
mtp = new MaskedTextProvider ("abaa");
mtp.InsertAt ('z', 0);
mtp.InsertAt ('z', 2);
Assert.AreEqual (true, mtp.InsertAt (' ', 1, out Int32_out, out MaskedTextResultHint_out), "#G1");
Assert.AreEqual ("zb z", mtp.ToString (), "G2");
Assert.AreEqual (2, Int32_out, "G3");
Assert.AreEqual (MaskedTextResultHint.Success, MaskedTextResultHint_out, "G4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_G", 1, true, false, 2, 1, CultureInfo.GetCultureInfo ("es-ES"), 3, true, false, false, 3, 4, @"abaa", true, false, '\x0', '\x5F', true, true, true, @"zb z", @"zb z", @"zb z", @"zb_z", @"z_z", @"zb z", @"z z");
// insert space over literal with only more literals later on
mtp = new MaskedTextProvider ("abb");
Assert.AreEqual (false, mtp.InsertAt (' ', 1, out Int32_out, out MaskedTextResultHint_out), "#G1");
Assert.AreEqual (" bb", mtp.ToString (), "G2");
Assert.AreEqual (3, Int32_out, "G3");
Assert.AreEqual (MaskedTextResultHint.UnavailableEditPosition, MaskedTextResultHint_out, "G4");
MaskedTextProviderTest.AssertProperties (mtp, "InsertAt_charTest_G", 1, true, false, 0, 1, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, -1, 3, @"abb", true, false, '\x0', '\x5F', true, true, true, @" bb", @" bb", @" bb", @"_bb", @"_", @" bb", @"");
}