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.
SyntaxParameters
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
RequirementsNamespace: 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.
SyntaxParameters
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
RequirementsNamespace: 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.
SyntaxParameters
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
RequirementsNamespace: 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.
SyntaxType 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
RequirementsNamespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Fail Method
Throws an exception always.
Syntaxpublic static void Fail (string diagnostic)
Parameters
diagnostic
Optional string to show with a faulure exception.
Remarks
RequirementsNamespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Greater Generic Method
SyntaxType 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
RequirementsNamespace: 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.
Syntaxpublic static bool LogSuccessful { get; set; }
Value
Remarks
RequirementsNamespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
NotEqual Generic Method
SyntaxType 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
RequirementsNamespace: 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.
SyntaxParameters
val
The value that must be null.
diagnostic
Optional string to show with a faulure exception.
Remarks
RequirementsNamespace: 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.
SyntaxParameters
val
The value that must be null.
diagnostic
Optional string to show with a faulure exception.
Remarks
RequirementsNamespace: 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.
SyntaxParameters
message
The message to check.
contents
A substring to check.
diagnostic
Optional string to show with a faulure exception.
Remarks
RequirementsNamespace: 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.
SyntaxParameters
val
The value that must be true.
diagnostic
Optional string to show with a faulure exception.
Remarks
RequirementsNamespace: 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.
SyntaxParameters
typename
The expected typename.
obj
The object to check.
diagnostic
Optional string to show with a faulure exception.
Remarks
RequirementsNamespace: 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.
SyntaxType Parameters
T
The type to confirm.
Parameters
obj
The object to check.
diagnostic
Optional string to show with a faulure exception.
Remarks
RequirementsNamespace: Sansar.Script.Testing Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Last updated