Assertions Class
Contains various test methods which throw exceptions if the conditions are false.
Syntax
public static class Assertions
Remarks
This class is restricted and may not be included in scripts for sale in the marketplace. All APIs are subject to change.
Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Members
See Also: Inherited members from object.
Public Properties
static
|
LogSuccessful | bool . Enables or disables logging of successful assertion diagnostic messages. |
Public Methods
static
|
AlmostEqual (Sansar.Quaternion, Sansar.Quaternion, int, string)
Throws an exception if the two Quaternions are not approximately equal. |
|
static
|
AlmostEqual (Sansar.Vector, Sansar.Vector, int, string)
Throws an exception if the two vectors are not approximately equal. |
|
static
|
AlmostEqual (float, float, int, string)
Throws an exception if the two floats are not approximately equal. |
|
static
|
Equal<T> (T, T, string)
Throws an exception if the passed objects do not compare as equal via IComparable.CompareTo(object). Will NOT throw if both objects are null. |
|
static
|
Fail (string)
Throws an exception always. |
|
static
|
Greater<T> (T, T, string)
Throws an exception if the first object does not compare as greater via IComparable.CompareTo(object). |
|
static
|
NotEqual<T> (T, T, string)
Throws an exception if the passed objects compare as equal via IComparable.CompareTo(object). |
|
static
|
NotNull (object, string)
Throws an exception if the passed argument is not null. |
|
static
|
Null (object, string)
Throws an exception if the passed argument is not null. |
|
static
|
NullOrMissing (string, string, string)
Throws an exception if the message is non-null and contains the contents substring. |
|
static
|
True (bool, string)
Throws an exception if the passed argument is false. |
|
static
|
Type (string, object, string)
Throws an exception if the Type.FullName of the passed object does not match the passed typename. |
|
static
|
Type<T> (object, string)
Throws an exception if the passed type is not of the same type as the type param or if the obj is null. |
Member Details
AlmostEqual Method
Throws an exception if the two Quaternions are not approximately equal.Syntax
public static void AlmostEqual (Sansar.Quaternion a, Sansar.Quaternion b, int significantFigures, string diagnostic)Parameters
- a
- The first Quaternion to check.
- b
- The second Quaternion to check.
- significantFigures
- The number of significant digits to compare
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
AlmostEqual Method
Throws an exception if the two vectors are not approximately equal.Syntax
public static void AlmostEqual (Sansar.Vector a, Sansar.Vector b, int significantFigures, string diagnostic)Parameters
- a
- The first vector to check.
- b
- The second vector to check.
- significantFigures
- The number of significant digits to compare
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
AlmostEqual Method
Throws an exception if the two floats are not approximately equal.Syntax
Parameters
- a
- The first float to check.
- b
- The second float to check.
- significantFigures
- The number of significant digits to compare
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Equal<T> Generic Method
Throws an exception if the passed objects do not compare as equal via IComparable.CompareTo(object). Will NOT throw if both objects are null.Syntax
Type Parameters
- T
- The type of the objects.
Parameters
- a
- The first object to check.
- b
- The second object to check.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Fail Method
Throws an exception always.Syntax
Parameters
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Greater<T> Generic Method
Throws an exception if the first object does not compare as greater via IComparable.CompareTo(object).Syntax
Type Parameters
- T
- The type of the objects.
Parameters
- a
- The first object to check.
- b
- The second object to check.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
LogSuccessful Property
Enables or disables logging of successful assertion diagnostic messages.Syntax
public static bool LogSuccessful { get; set; }Value
Remarks
This can be used to trace test execution.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
NotEqual<T> Generic Method
Throws an exception if the passed objects compare as equal via IComparable.CompareTo(object).Syntax
Type Parameters
- T
- The type of the objects.
Parameters
- a
- The first object to check.
- b
- The second object to check.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
NotNull Method
Throws an exception if the passed argument is not null.Syntax
Parameters
- val
- The value that must be null.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Null Method
Throws an exception if the passed argument is not null.Syntax
Parameters
- val
- The value that must be null.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
NullOrMissing Method
Throws an exception if the message is non-null and contains the contents substring.Syntax
Parameters
- message
- The message to check.
- contents
- A substring to check.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
True Method
Throws an exception if the passed argument is false.Syntax
Parameters
- val
- The value that must be true.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Type Method
Throws an exception if the Type.FullName of the passed object does not match the passed typename.Syntax
Parameters
- typename
- The expected typename.
- obj
- The object to check.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Type<T> Generic Method
Throws an exception if the passed type is not of the same type as the type param or if the obj is null.Syntax
Type Parameters
- T
- The type to confirm.
Parameters
- obj
- The object to check.
- diagnostic
- Optional string to show with a faulure exception.
Remarks
The method is restricted. The method is subject to change or removal at any time and may not be included in scripts for sale in the marketplace.Requirements
Namespace: Sansar.Script.Testing
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
0 Comments