static void GenerateAdd_string_int_MaskedTextResultHint_Test () { string Name = "mtp"; string TestName = MethodInfo.GetCurrentMethod ().Name.Replace ("Generate", ""); int counter = 0; WriteTestHeader (TestName, "MaskedTextProvider mtp;", "int testPosition;", "MaskedTextResultHint resultHint;", "bool result;", "int Int32_out = 0;", "MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;"); MS_System_ComponentModel.MaskedTextProvider mtp = null; int testPosition = 0; MS_System_ComponentModel.MaskedTextResultHint resultHint = MS_System_ComponentModel.MaskedTextResultHint.Unknown; bool result; foreach (string mask in test_masks) { foreach (string [] strings in add_string_test_values) { foreach (string s in strings) { bool more_states = true; int stateindex = 0; do { object [] arguments; arguments = new object [] { s, testPosition, resultHint }; if (Compare ("Add", mask, ref stateindex, arguments, ref more_states)) { continue; } WriteTestStart (); mtp = new MS_System_ComponentModel.MaskedTextProvider (mask); WriteLine ("mtp = new MaskedTextProvider (@\"" + mask.Replace ("\"", "\"\"") + "\");"); more_states = CreateState (mtp, stateindex); stateindex++; result = mtp.Add (s, out testPosition, out resultHint); WriteLineNonFormat ("result = mtp.Add (@\"" + s.Replace ("\"", "\"\"") + "\", out testPosition, out resultHint);"); WriteLine ("Assert.AreEqual ({0}, result, \"{1}#{2}\");", GetStringValue (result), TestName, (counter++).ToString ()); WriteLine ("Assert.AreEqual ({0}, resultHint, \"{1}#{2}\");", GetStringValue (resultHint), TestName, (counter++).ToString ()); WriteLine ("Assert.AreEqual ({0}, testPosition, \"{1}#{2}\");", GetStringValue (testPosition), TestName, (counter++).ToString ()); WriteAssertProperties (mtp, Name, TestName, ref counter); WriteLine (""); WriteTestEnd (); } while (more_states); } } } WriteTestFooter (); }
static void GenerateAdd_char_Test () { string Name = "mtp"; string TestName = MethodInfo.GetCurrentMethod ().Name.Replace ("Generate", ""); int counter = 0; bool result; MS_System_ComponentModel.MaskedTextProvider mtp = null; WriteTestHeader (TestName, "MaskedTextProvider mtp;", "int testPosition;", "MaskedTextResultHint resultHint;", "bool result;", "int Int32_out = 0;", "MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;"); foreach (string mask in test_masks) { foreach (char [] chars in add_char_test_values) { foreach (char c in chars) { bool more_states = true; int stateindex = 0; do { object [] arguments; arguments = new object [] { c }; if (Compare ("Add", mask, ref stateindex, arguments, ref more_states)) { continue; } WriteTestStart (); mtp = new MS_System_ComponentModel.MaskedTextProvider (mask); WriteLine ("mtp = new MaskedTextProvider (@\"" + mask.Replace ("\"", "\"\"") + "\");"); more_states = CreateState (mtp, stateindex); stateindex++; result = mtp.Add (c); WriteLine (string.Format ("result = mtp.Add ('\\x{0:X4}');", (int)c) + (c != char.MinValue ? "/* " + c.ToString () + " */" : "/* null */")); WriteLine ("Assert.AreEqual ({0}, result, \"{1}#{2}\");", GetStringValue (result), TestName, (counter++).ToString ()); WriteAssertProperties (mtp, Name, TestName, ref counter); WriteTestEnd (); } while (more_states); } } } WriteTestFooter (); }