Example #1
0
 public static Object StrDup(int Number, Object Character)
 {
     if (Number < 0)
     {
         throw new ArgumentException
                   (S._("VB_NonNegative"), "Number");
     }
     if (Character == null)
     {
         throw new ArgumentNullException("Character");
     }
     else if (Character is String)
     {
         return(StrDup(Number, (String)Character));
     }
     else if (Character is Char)
     {
         return(StrDup(Number, (Char)Character));
     }
     else
     {
         try
         {
             return(StrDup(Number, CharType.FromObject(Character)));
         }
         catch (Exception)
         {
             throw new ArgumentException
                       (S._("VB_NotAChar"), "Character");
         }
     }
 }
Example #2
0
 public void FromObject_ThrowsOverflowException(object value)
 {
     Assert.Throws <OverflowException>(() => CharType.FromObject(value));
 }
Example #3
0
 public void FromObject_ThrowsInvalidCastException(object value)
 {
     Assert.Throws <InvalidCastException>(() => CharType.FromObject(value));
 }
Example #4
0
 public void FromObject_NotSupported(object value, char expected)
 {
     Assert.Throws <InvalidCastException>(() => CharType.FromObject(value));
 }
Example #5
0
 public void FromObject(object value, char expected)
 {
     Assert.Equal(expected, CharType.FromObject(value));
 }