Contains various test methods which throw exceptions if the conditions are false.
public static class AssertionsRemarks
This class is restricted and may not be included in scripts for sale in the marketplace. All APIs are subject to change.
Members at a glance
| Kind | Members |
|---|---|
| Properties | LogSuccessful |
| Methods | AlmostEqual · Equal · Fail · Greater · NotEqual · NotNull · Null · NullOrMissing · True · Type |
Properties
LogSuccessful
public static bool LogSuccessful { get; set; }Enables or disables logging of successful assertion diagnostic messages.
Remarks
This can be used to trace test execution.
Methods
AlmostEqual
public static void AlmostEqual(
Sansar.Quaternion a,
Sansar.Quaternion b,
int significantFigures,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the two Quaternions are not approximately equal.
| Parameter | Type | Description |
|---|---|---|
a | Sansar.Quaternion | The first Quaternion to check. |
b | Sansar.Quaternion | The second Quaternion to check. |
significantFigures | int | The number of significant digits to compare |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
public static void AlmostEqual(
Sansar.Vector a,
Sansar.Vector b,
int significantFigures,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the two vectors are not approximately equal.
| Parameter | Type | Description |
|---|---|---|
a | Sansar.Vector | The first vector to check. |
b | Sansar.Vector | The second vector to check. |
significantFigures | int | The number of significant digits to compare |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
public static void AlmostEqual(
float a,
float b,
int significantFigures,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the two floats are not approximately equal.
| Parameter | Type | Description |
|---|---|---|
a | float | The first float to check. |
b | float | The second float to check. |
significantFigures | int | The number of significant digits to compare |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
Equal
public static void Equal<T>(
T a,
T b,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
) where T : IComparableThrows an exception if the passed objects do not compare as equal via IComparable.CompareTo. Will NOT throw if both objects are null.
| Parameter | Type | Description |
|---|---|---|
a | T | The first object to check. |
b | T | The second object to check. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
Type parameters: T: The type of the objects.
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.
Fail
public static void Fail(
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception always.
| Parameter | Type | Description |
|---|---|---|
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
Greater
public static void Greater<T>(
T a,
T b,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
) where T : IComparableThrows an exception if the first object does not compare as greater via IComparable.CompareTo.
| Parameter | Type | Description |
|---|---|---|
a | T | The first object to check. |
b | T | The second object to check. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
Type parameters: T: The type of the objects.
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.
NotEqual
public static void NotEqual<T>(
T a,
T b,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
) where T : IComparableThrows an exception if the passed objects compare as equal via IComparable.CompareTo.
| Parameter | Type | Description |
|---|---|---|
a | T | The first object to check. |
b | T | The second object to check. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
Type parameters: T: The type of the objects.
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.
NotNull
public static void NotNull(
object val,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the passed argument is not null.
| Parameter | Type | Description |
|---|---|---|
val | object | The value that must be null. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
Null
public static void Null(
object val,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the passed argument is not null.
| Parameter | Type | Description |
|---|---|---|
val | object | The value that must be null. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
NullOrMissing
public static void NullOrMissing(
string message,
string contents,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the message is non-null and contains the contents substring.
| Parameter | Type | Description |
|---|---|---|
message | string | The message to check. |
contents | string | A substring to check. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
True
public static void True(
bool val,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the passed argument is false.
| Parameter | Type | Description |
|---|---|---|
val | bool | The value that must be true. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
Type
public static void Type(
string typename,
object obj,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the Type.FullName of the passed object does not match the passed typename.
| Parameter | Type | Description |
|---|---|---|
typename | string | The expected typename. |
obj | object | The object to check. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
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.
public static void Type<T>(
object obj,
string diagnostic,
[System.Runtime.CompilerServices.CallerMemberName] string memberName,
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath,
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber
)Throws an exception if the passed type is not of the same type as the type param or if the obj is null.
| Parameter | Type | Description |
|---|---|---|
obj | object | The object to check. |
diagnostic | string | Optional string to show with a faulure exception. |
memberName | string | generated by the compiler |
sourceFilePath | string | generated by the compiler |
sourceLineNumber | int | generated by the compiler |
Type parameters: T: The type to confirm.
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.
Generated from the Sansar 47.10.0 client ScriptApi snapshot.