> For the complete documentation index, see [llms.txt](https://docs.sansar.com/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sansar.com/latest/script-api-docs/sansar-script-testing/assertions.md).

# 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)](http://www.go-mono.com/docs/monodoc.ashx?link=M:System.IComparable.CompareTo\(System.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](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **Fail** ([string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.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](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean) **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](http://www.go-mono.com/docs/monodoc.ashx?link=P:System.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
>
> ***

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sansar.com/latest/script-api-docs/sansar-script-testing/assertions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
