C# 클래스 Spring.Util.AssertUtils

Assertion utility methods that simplify things such as argument checks.

Not intended to be used directly by applications.

파일 보기 프로젝트 열기: spring-projects/spring-net 1 사용 예제들

공개 메소드들

메소드 설명
ArgumentHasElements ( ICollection argument, string name ) : void

Checks the value of the supplied ICollection argument and throws an ArgumentException if it is , contains no elements or only null elements.

ArgumentHasLength ( ICollection argument, string name ) : void

Checks the value of the supplied ICollection argument and throws an ArgumentNullException if it is or contains no elements.

ArgumentHasLength ( ICollection argument, string name, string message ) : void

Checks the value of the supplied ICollection argument and throws an ArgumentNullException if it is or contains no elements.

ArgumentHasText ( string argument, string name ) : void

Checks the value of the supplied string argument and throws an System.ArgumentNullException if it is or contains only whitespace character(s).

ArgumentHasText ( string argument, string name, string message ) : void

Checks the value of the supplied string argument and throws an System.ArgumentNullException if it is or contains only whitespace character(s).

ArgumentNotNull ( object argument, string name ) : void

Checks the value of the supplied argument and throws an System.ArgumentNullException if it is .

ArgumentNotNull ( object argument, string name, string message ) : void

Checks the value of the supplied argument and throws an System.ArgumentNullException if it is .

AssertArgumentType ( object argument, string argumentName, Type requiredType, string message ) : void

Checks whether the specified argument can be cast into the requiredType.

IsTrue ( bool expression ) : void

Assert a boolean expression, throwing ArgumentException if the test result is false.

IsTrue ( bool expression, string message ) : void

Assert a boolean expression, throwing ArgumentException if the test result is false.

State ( bool expression, string message ) : void

Assert a bool expression, throwing InvalidOperationException if the expression is false.

Understands ( object target, string targetName, MethodBase method ) : void

Checks, whether method may be invoked on target. Supports testing transparent proxies.

Understands ( object target, string targetName, Type requiredType ) : void

checks, whether target supports the methods of requiredType. Supports testing transparent proxies.

비공개 메소드들

메소드 설명
AssertUtils ( ) : System

Creates a new instance of the Spring.Util.AssertUtils class.

This is a utility class, and as such exposes no public constructors.

메소드 상세

ArgumentHasElements() 공개 정적인 메소드

Checks the value of the supplied ICollection argument and throws an ArgumentException if it is , contains no elements or only null elements.
/// If the supplied is , /// contains no elements or only null elements. ///
public static ArgumentHasElements ( ICollection argument, string name ) : void
argument ICollection The array or collection to check.
name string The argument name.
리턴 void

ArgumentHasLength() 공개 정적인 메소드

Checks the value of the supplied ICollection argument and throws an ArgumentNullException if it is or contains no elements.
/// If the supplied is or /// contains no elements. ///
public static ArgumentHasLength ( ICollection argument, string name ) : void
argument ICollection The array or collection to check.
name string The argument name.
리턴 void

ArgumentHasLength() 공개 정적인 메소드

Checks the value of the supplied ICollection argument and throws an ArgumentNullException if it is or contains no elements.
/// If the supplied is or /// contains no elements. ///
public static ArgumentHasLength ( ICollection argument, string name, string message ) : void
argument ICollection The array or collection to check.
name string The argument name.
message string An arbitrary message that will be passed to any thrown .
리턴 void

ArgumentHasText() 공개 정적인 메소드

Checks the value of the supplied string argument and throws an System.ArgumentNullException if it is or contains only whitespace character(s).
/// If the supplied is or /// contains only whitespace character(s). ///
public static ArgumentHasText ( string argument, string name ) : void
argument string The string to check.
name string The argument name.
리턴 void

ArgumentHasText() 공개 정적인 메소드

Checks the value of the supplied string argument and throws an System.ArgumentNullException if it is or contains only whitespace character(s).
/// If the supplied is or /// contains only whitespace character(s). ///
public static ArgumentHasText ( string argument, string name, string message ) : void
argument string The string to check.
name string The argument name.
message string /// An arbitrary message that will be passed to any thrown /// . ///
리턴 void

ArgumentNotNull() 공개 정적인 메소드

Checks the value of the supplied argument and throws an System.ArgumentNullException if it is .
/// If the supplied is . ///
public static ArgumentNotNull ( object argument, string name ) : void
argument object The object to check.
name string The argument name.
리턴 void

ArgumentNotNull() 공개 정적인 메소드

Checks the value of the supplied argument and throws an System.ArgumentNullException if it is .
/// If the supplied is . ///
public static ArgumentNotNull ( object argument, string name, string message ) : void
argument object The object to check.
name string The argument name.
message string /// An arbitrary message that will be passed to any thrown /// . ///
리턴 void

AssertArgumentType() 공개 정적인 메소드

Checks whether the specified argument can be cast into the requiredType.
public static AssertArgumentType ( object argument, string argumentName, Type requiredType, string message ) : void
argument object /// The argument to check. ///
argumentName string /// The name of the argument to check. ///
requiredType System.Type /// The required type for the argument. ///
message string /// An arbitrary message that will be passed to any thrown /// . ///
리턴 void

IsTrue() 공개 정적인 메소드

Assert a boolean expression, throwing ArgumentException if the test result is false.
/// if expression is false ///
public static IsTrue ( bool expression ) : void
expression bool a boolean expression.
리턴 void

IsTrue() 공개 정적인 메소드

Assert a boolean expression, throwing ArgumentException if the test result is false.
/// if expression is false ///
public static IsTrue ( bool expression, string message ) : void
expression bool a boolean expression.
message string The exception message to use if the assertion fails.
리턴 void

State() 공개 정적인 메소드

Assert a bool expression, throwing InvalidOperationException if the expression is false.
if expression is false
public static State ( bool expression, string message ) : void
expression bool a boolean expression.
message string The exception message to use if the assertion fails
리턴 void

Understands() 공개 정적인 메소드

Checks, whether method may be invoked on target. Supports testing transparent proxies.
/// if is null /// /// if it is not possible to invoke on ///
public static Understands ( object target, string targetName, MethodBase method ) : void
target object the target instance or null
targetName string the name of the target to be used in error messages
method System.Reflection.MethodBase the method to test for
리턴 void

Understands() 공개 정적인 메소드

checks, whether target supports the methods of requiredType. Supports testing transparent proxies.
/// if is null /// /// if it is not possible to invoke methods of /// type on ///
public static Understands ( object target, string targetName, Type requiredType ) : void
target object the target instance or null
targetName string the name of the target to be used in error messages
requiredType System.Type the type to test for
리턴 void