Class NetcodeLogAssert
Class used to handle asserting if certain log messages were not logged.
Implements
Inherited Members
Namespace: Unity.Netcode.RuntimeTests
Assembly: Unity.Netcode.Runtime.Tests.dll
Syntax
public class NetcodeLogAssert : IDisposable
Constructors
NetcodeLogAssert(bool, bool)
Constructor
Declaration
public NetcodeLogAssert(bool ignorFailingMessages = false, bool resetOnTearDown = true)
Parameters
Type | Name | Description |
---|---|---|
bool | ignorFailingMessages | true or false |
bool | resetOnTearDown | true or false |
Methods
AddLog(string, string, LogType)
Invoke to add a log during a test.
Declaration
public void AddLog(string message, string stacktrace, LogType type)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message to log. |
string | stacktrace | The stack trace of where the issue occurred. |
LogType | type | The LogType. |
Dispose()
Dispose method
Declaration
public void Dispose()
HasLogBeenReceived(LogType, string)
Determines if a log message was logged or not.
Declaration
public bool HasLogBeenReceived(LogType type, string message)
Parameters
Type | Name | Description |
---|---|---|
LogType | type | LogType to check for. |
string | message | string containing the message to search for. |
Returns
Type | Description |
---|---|
bool | true or false |
LogWasNotReceived(LogType, string)
Assert if a log message was logged with the expectation it would not be.
Declaration
public void LogWasNotReceived(LogType type, string message)
Parameters
Type | Name | Description |
---|---|---|
LogType | type | LogType to check for. |
string | message | string containing the message to search for. |
LogWasNotReceived(LogType, Regex)
Assert if a log message was logged with the expectation it would not be. (RegEx version)
Declaration
public void LogWasNotReceived(LogType type, Regex messageRegex)
Parameters
Type | Name | Description |
---|---|---|
LogType | type | LogType to check for. |
Regex | messageRegex | Regex containing the message pattern to search for. |
LogWasReceived(LogType, string)
Assert if a log message was not logged with the expectation that it would be.
Declaration
public void LogWasReceived(LogType type, string message)
Parameters
Type | Name | Description |
---|---|---|
LogType | type | LogType to check for. |
string | message | string containing the message to search for. |
LogWasReceived(LogType, Regex)
Assert if a log message was not logged with the expectation that it would be. (RegEx version)
Declaration
public void LogWasReceived(LogType type, Regex messageRegex)
Parameters
Type | Name | Description |
---|---|---|
LogType | type | LogType to check for. |
Regex | messageRegex | Regex containing the message pattern to search for. |
OnTearDown()
Tear down method
Declaration
public void OnTearDown()
Reset()
Clears out the log history that is searched.
Declaration
public void Reset()