Namespace Unity.Netcode.TestHelpers.Runtime
Classes
ConditionalPredicateBase
Derive from this class to create your own conditional handling for your NetcodeIntegrationTest integration tests when dealing with more complicated scenarios where initializing values, storing state to be used across several integration tests.
IntegrationTestWithApproximation
An extended NetcodeIntegrationTest class that includes various helper mehtods to handle aproximating float various in order to avoid floating point drift related errors.
MessageHookEntry
Class that defines the MessageHooks to use with MessageHooksConditional.
MessageHooksConditional
A Netcode for GameObjects message conditional class to determine if a specific message has been sent or received.
MockTimeProvider
A mock timer that implements the Unity.Netcode.IRealTimeProvider interface used with integration testing.
NetcodeIntegrationTest
The default Netcode for GameObjects integration test helper class
NetcodeIntegrationTestHelpers
Provides helpers for running multi instance tests.
NetcodeIntegrationTestHelpers.ResultWrapper<T>
Used to return a value of type T from a wait condition
NetworkManagerHelper
Helper class to instantiate a NetworkManager This also provides the ability to: --- instantiate GameObjects with NetworkObject components that returns a Guid for accessing it later. --- add NetworkBehaviour components to the instantiated GameObjects --- spawn a NetworkObject using its parent GameObject's Guid Call StartNetworkManager in the constructor of your runtime unit test class. Call ShutdownNetworkManager in the destructor of your runtime unit test class.
Includes a useful "BuffersMatch" method that allows you to compare two buffers (returns true if they match false if not)
NetworkVariableBaseHelper
The BaseNetworkVariableHelper keeps track of: The number of instances and associates the instance with the NetworkVariable The number of times a specific NetworkVariable instance had its value changed (i.e. !Equal) Note: This could be expanded for future tests focuses around NetworkVariables
NetworkVariableHelper<T>
Will automatically register for the NetworkVariable OnValueChanged delegate handler. It then will expose that single delegate invocation to anything that registers for this NetworkVariableHelper's instance's OnValueChanged event. This allows us to register any NetworkVariable type as well as there are basically two "types of types":
- IEquatable<T>
- ValueType
ObjectNameIdentifier
Used in conjunction with integratioin tests, this NetworkBehaviour derived class is used to provide additional identification information in the name of the spawned objects in order to simplify finding a specific instance. NetcodeIntegrationTest
TimeoutFrameCountHelper
This can be used in place of TimeoutHelper if you suspect a test is having issues on a system where the frame rate is running slow than expected and allowing a certain number of frame updates is required.
TimeoutHelper
Can be used independently or assigned to WaitForConditionOrTimeOut(Func<bool>, TimeoutHelper) in the event the default timeout period needs to be adjusted
Interfaces
IConditionalPredicate
A conditional predicate interface used with integration testing.
Enums
NetcodeIntegrationTest.HostOrServer
Typically used with NUnit.Framework.TestFixtureAttribute to define what kind of authority NetworkManager to use.
NetcodeIntegrationTest.NetworkManagerInstatiationMode
Used to define how long NetworkManager instances persist between tests or if any should be created at all.
NetcodeIntegrationTest.SceneManagementState
Used with NUnit.Framework.ValuesAttribute to describe whether scene management is enabled or disabled.
NetworkManagerHelper.NetworkManagerOperatingMode
This provides the ability to start NetworkManager in various modes
ReceiptType
Enum used with MessageHooksConditional and integration testing.
Delegates
NetcodeIntegrationTestHelpers.BeforeClientStartCallback
Delegate callback for notifications prior to a client starting.
NetcodeIntegrationTestHelpers.MessageHandleCheck
Delegate to handle checking messages
NetworkVariableHelper<T>.OnMyValueChangedDelegateHandler
Delegate defining OnValueChanged.