public static void NewArgumentExceptionForInvalidType(
     [Values(null, "", "param")] string paramName,
     [Values(typeof(object), typeof(string), typeof(int))] Type paramType
     )
 {
     Assert.That(ExceptionUtilities.NewArgumentExceptionForInvalidType(paramName, paramType),
                 Is.InstanceOf <ArgumentException>()
                 .With.Property("ParamName").EqualTo(paramName)
                 );
 }
Beispiel #2
0
 /// <summary>Compares a <see cref="object" /> with the current instance to determine relative sort-order.</summary>
 /// <param name="obj">The <see cref="object" /> to compare with the current instance.</param>
 /// <returns>A value <c>less than zero</c> if <paramref name="obj" /> is greater than the current instance, <c>zero</c> if <paramref name="obj"/> is equal to the current instance; and <c>greater than zero</c> if <paramref name="obj" /> is <c>null</c> or greater than the current instance.</returns>
 /// <exception cref="ArgumentException"><paramref name="obj" /> is not <c>null</c> and is not an instance of <see cref="Window" />.</exception>
 public int CompareTo(object obj)
 {
     if (obj is null)
     {
         return(1);
     }
     else if (obj is Window other)
     {
         return(CompareTo(other));
     }
     else
     {
         throw ExceptionUtilities.NewArgumentExceptionForInvalidType(nameof(obj), obj.GetType());
     }
 }