Ejemplo n.º 1
0
 /// <summary>
 /// Append a definition to a string buffer.
 /// </summary>
 /// <param name="definition">
 /// The definition to append to a string buffer.
 /// </param>
 /// <param name="sb">
 /// The string buffer.
 /// </param>
 /// <exception cref="ArgumentException">
 /// This exception is thrown if <paramref name="sb"/> or <paramref name="definition"/> is not effective.
 /// </exception>
 private static void WriteDefinition(Definition definition, StringBuilder sb)
 {
     if (definition != null && sb != null)
     {
         WriteTab(sb);
         sb.Append(definition.ToString());
         WriteLine(sb);
     }
     else
     {
         throw new ArgumentException();
     }
 }
Ejemplo n.º 2
0
 private static void EnsureNameIsGood(Definition definition, object control, Type testerType)
 {
     Definition goodName = GetNewDefinition(control, testerType);
     definition.Name = goodName.Name;
     if (goodName.FormName != null)
     {
         definition.FormName = goodName.FormName;
     }
 }
Ejemplo n.º 3
0
 private static Definition GetNewDefinition(object control, Type testerType)
 {
     Definition newDefinition;
     try
     {
         newDefinition = new Definition(control, GetName(control, null), testerType, null);
     }
     catch (AmbiguousNameException)
     {
         Form form = ((Control) control).FindForm(); //TODO: fix this! not always a control :(
         newDefinition = new Definition(control, GetName(control, form), testerType, form.Name);
     }
     return newDefinition;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Add a definition to the list of definitions.
 /// </summary>
 /// <param name="definition">
 /// The definition which will be added.
 /// </param>
 /// <exception cref="ArgumentException">
 /// This exception is thrown if <paramref name="definition"/> is not effective.
 /// </exception>
 public void AddDefinition(Definition definition)
 {
     if (definition != null)
     {
         definitions.Add(definition);
         UpdateTest();
     }
     else
     {
         throw new ArgumentException();
     }
 }