Assertions

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

Members

See Also: Inherited members from object.

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
Greater<T> (T, T, string)
Throws an exception if the first object does not compare as greater 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

public static void AlmostEqual (float a, float b, int significantFigures, string diagnostic)

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

public static void Equal<T> (T a, T b, string diagnostic)
where T : IComparable

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

Greater<T> Generic Method

Throws an exception if the first object does not compare as greater via IComparable.CompareTo(object).

Syntax

public static void Greater<T> (T a, T b, string diagnostic)
where T : IComparable

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

public static void NotNull (object val, string diagnostic)

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

public static void Null (object val, string diagnostic)

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

public static void NullOrMissing (string message, string contents, string diagnostic)

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

public static void True (bool val, string diagnostic)

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

public static void Type (string typename, object obj, string diagnostic)

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

public static void Type<T> (object obj, string diagnostic)

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


Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.