Assertions

Assertions Class

Contains various test methods which throw exceptions if the conditions are false.

Syntax

public static class Assertions

Member Details

AlmostEqual Method

Throws an exception if the two Quaternions are not approximately equal.

Syntax

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

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

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

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

Requirements

Namespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0


Equal 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

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

public static void Fail (string diagnostic)

Parameters

diagnostic

Optional string to show with a faulure exception.

Remarks

Requirements

Namespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0


Greater Generic Method

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

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

Requirements

Namespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0


NotEqual Generic Method

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

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

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

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

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

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

Requirements

Namespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0


Type 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

Requirements

Namespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0



Last updated