Skip to content

Commit 6ea32ce

Browse files
fix: pvp-151-1
Fixing some stragglers.
1 parent 1900de6 commit 6ea32ce

File tree

7 files changed

+80
-18
lines changed

7 files changed

+80
-18
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTestsHelperTypes.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,49 +129,49 @@ internal struct TemplatedValueOnlyReferencedByNetworkVariableSubclass<T> : INetw
129129
public T Value;
130130
}
131131

132-
public enum ByteEnum : byte
132+
internal enum ByteEnum : byte
133133
{
134134
A,
135135
B,
136136
C = byte.MaxValue
137137
}
138-
public enum SByteEnum : sbyte
138+
internal enum SByteEnum : sbyte
139139
{
140140
A,
141141
B,
142142
C = sbyte.MaxValue
143143
}
144-
public enum ShortEnum : short
144+
internal enum ShortEnum : short
145145
{
146146
A,
147147
B,
148148
C = short.MaxValue
149149
}
150-
public enum UShortEnum : ushort
150+
internal enum UShortEnum : ushort
151151
{
152152
A,
153153
B,
154154
C = ushort.MaxValue
155155
}
156-
public enum IntEnum : int
156+
internal enum IntEnum : int
157157
{
158158
A,
159159
B,
160160
C = int.MaxValue
161161
}
162-
public enum UIntEnum : uint
162+
internal enum UIntEnum : uint
163163
{
164164
A,
165165
B,
166166
C = uint.MaxValue
167167
}
168-
public enum LongEnum : long
168+
internal enum LongEnum : long
169169
{
170170
A,
171171
B,
172172
C = long.MaxValue
173173
}
174-
public enum ULongEnum : ulong
174+
internal enum ULongEnum : ulong
175175
{
176176
A,
177177
B,

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/ConditionalPredicate.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ public class ConditionalPredicateBase : IConditionalPredicate
1010
{
1111
private bool m_TimedOut;
1212

13+
/// <summary>
14+
/// Will be set to <see cref="true"/> if timed out.
15+
/// </summary>
1316
public bool TimedOut { get { return m_TimedOut; } }
1417

1518
/// <summary>
@@ -59,6 +62,7 @@ public interface IConditionalPredicate
5962
/// <summary>
6063
/// Test the conditions of the test to be reached
6164
/// </summary>
65+
/// <returns><see cref="true"/> or <see cref="false"/></returns>
6266
bool HasConditionBeenReached();
6367

6468
/// <summary>
@@ -67,9 +71,10 @@ public interface IConditionalPredicate
6771
void Started();
6872

6973
/// <summary>
70-
/// Wait for condition has finished:
74+
/// Wait for condition has finished: <br />
7175
/// Condition(s) met or timed out
7276
/// </summary>
77+
/// <param name="timedOut"><see cref="true"/> or <see cref="false"/></param>
7378
void Finished(bool timedOut);
7479

7580
}

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/MessageHooksConditional.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ protected override void OnFinished()
6767
base.OnFinished();
6868
}
6969

70-
/// <inheritdoc/>
70+
/// <summary>
71+
/// Resets the instance.
72+
/// </summary>
7173
public void Reset()
7274
{
7375
foreach (var entry in m_MessageHookEntries)

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ public abstract class NetcodeIntegrationTest
5252
/// </summary>
5353
public enum SceneManagementState
5454
{
55+
/// <summary>
56+
/// Scene management is enabled.
57+
/// </summary>
5558
SceneManagementEnabled,
59+
/// <summary>
60+
/// Scene management is disabled.
61+
/// </summary>
5662
SceneManagementDisabled
5763
}
5864

@@ -115,8 +121,8 @@ public static void DeregisterNetworkObject(NetworkObject networkObject)
115121
/// Overloaded version of <see cref="DeregisterNetworkObject"/>. <br />
116122
/// Used by <see cref="ObjectNameIdentifier"/> to de-register a spawned <see cref="NetworkObject"/> instance.
117123
/// </summary>
118-
/// <param name="networkObject">The <see cref="NetworkManager"/>'s assigned client identifier.</param>
119-
/// <param name="networkObject">The <see cref="NetworkObject"/> being de-registered for a test in progress.</param>
124+
/// <param name="localClientId">The client instance identifier of the spawned <see cref="NetworkObject"/> instance.
125+
/// <param name="networkObjectId">The <see cref="NetworkObject.NetworkObjectId"/> of the spawned instance.</param>
120126
public static void DeregisterNetworkObject(ulong localClientId, ulong networkObjectId)
121127
{
122128
if (s_GlobalNetworkObjects.ContainsKey(localClientId) && s_GlobalNetworkObjects[localClientId].ContainsKey(networkObjectId))
@@ -1029,7 +1035,7 @@ protected void SetTimeTravelSimulatedDropRate(float dropRatePercent)
10291035
/// <summary>
10301036
/// When using time travel, you can use this method to simulate packet jitter conditions.
10311037
/// </summary>
1032-
/// <param name="dropRatePercent">The amount of packet jitter to be applied while time traveling.</param>
1038+
/// <param name="jitterSeconds">The amount of packet jitter to be applied while time traveling.</param>
10331039
protected void SetTimeTravelSimulatedLatencyJitter(float jitterSeconds)
10341040
{
10351041
((MockTransport)GetAuthorityNetworkManager().NetworkConfig.NetworkTransport).LatencyJitter = jitterSeconds;
@@ -1715,6 +1721,8 @@ protected void EnableMessageLogging()
17151721
/// Note: For more complex tests, <see cref="ConditionalPredicateBase"/> and the overloaded
17161722
/// version of this method
17171723
/// </summary>
1724+
/// <param name="checkForCondition">the conditional function to determine if the condition has been reached.</param>
1725+
/// <param name="timeOutHelper">the <see cref="TimeoutHelper"/> used to handle timing out the wait condition.</param>
17181726
/// <returns><see cref="IEnumerator"/></returns>
17191727
public static IEnumerator WaitForConditionOrTimeOut(Func<bool> checkForCondition, TimeoutHelper timeOutHelper = null)
17201728
{
@@ -1752,6 +1760,8 @@ public static IEnumerator WaitForConditionOrTimeOut(Func<bool> checkForCondition
17521760
/// Waits for the function condition to return true or it will time out. Uses time travel to simulate this
17531761
/// for the given number of frames, simulating delta times at the application frame rate.
17541762
/// </summary>
1763+
/// <param name="checkForCondition">the conditional function to determine if the condition has been reached.</param>
1764+
/// <param name="maxTries">the maximum times to check for the condition (default is 60).</param>
17551765
/// <returns><see cref="true"/> or <see cref="false"/></returns>
17561766
public bool WaitForConditionOrTimeOutWithTimeTravel(Func<bool> checkForCondition, int maxTries = 60)
17571767
{
@@ -1790,6 +1800,8 @@ public bool WaitForConditionOrTimeOutWithTimeTravel(Func<bool> checkForCondition
17901800
/// This version accepts an IConditionalPredicate implementation to provide
17911801
/// more flexibility for checking complex conditional cases.
17921802
/// </summary>
1803+
/// <param name="conditionalPredicate">An <see cref="IConditionalPredicate"/> implementation used to determine if the condition(s) has/have been met.</param>
1804+
/// <param name="timeOutHelper">the <see cref="TimeoutHelper"/> used to handle timing out the wait condition.</param>
17931805
/// <returns><see cref="IEnumerator"/></returns>
17941806
public static IEnumerator WaitForConditionOrTimeOut(IConditionalPredicate conditionalPredicate, TimeoutHelper timeOutHelper = null)
17951807
{
@@ -2028,6 +2040,9 @@ protected GameObject CreateNetworkObjectPrefab(string baseName)
20282040
/// <summary>
20292041
/// Overloaded method <see cref="SpawnObject(NetworkObject, NetworkManager, bool)"/>
20302042
/// </summary>
2043+
/// <param name="prefabGameObject">the prefab <see cref="GameObject"/> to spawn</param>
2044+
/// <param name="owner">the owner of the instance</param>
2045+
/// <param name="destroyWithScene">default is false</param>
20312046
/// <returns>The <see cref="GameObject"/> of the newly spawned <see cref="NetworkObject"/>.</returns>
20322047
protected GameObject SpawnObject(GameObject prefabGameObject, NetworkManager owner, bool destroyWithScene = false)
20332048
{
@@ -2039,6 +2054,9 @@ protected GameObject SpawnObject(GameObject prefabGameObject, NetworkManager own
20392054
/// <summary>
20402055
/// Overloaded method <see cref="SpawnObject(NetworkObject, NetworkManager, bool)"/>
20412056
/// </summary>
2057+
/// <param name="prefabGameObject">the prefab <see cref="GameObject"/> to spawn</param>
2058+
/// <param name="owner">the owner of the instance</param>
2059+
/// <param name="destroyWithScene">default is false</param>
20422060
/// <returns>The <see cref="GameObject"/> of the newly spawned player's <see cref="NetworkObject"/>.</returns>
20432061
protected GameObject SpawnPlayerObject(GameObject prefabGameObject, NetworkManager owner, bool destroyWithScene = false)
20442062
{
@@ -2050,9 +2068,10 @@ protected GameObject SpawnPlayerObject(GameObject prefabGameObject, NetworkManag
20502068
/// <summary>
20512069
/// Spawn a NetworkObject prefab instance
20522070
/// </summary>
2053-
/// <param name="prefabNetworkObject">the prefab NetworkObject to spawn</param>
2071+
/// <param name="prefabNetworkObject">the prefab <see cref="NetworkObject"/> to spawn</param>
20542072
/// <param name="owner">the owner of the instance</param>
20552073
/// <param name="destroyWithScene">default is false</param>
2074+
/// <param name="isPlayerObject">when <see cref="true"/>, the object will be spawned as the <see cref="NetworkManager.LocalClientId"/> owned player.</param>
20562075
/// <returns>GameObject instance spawned</returns>
20572076
private GameObject SpawnObject(NetworkObject prefabNetworkObject, NetworkManager owner, bool destroyWithScene = false, bool isPlayerObject = false)
20582077
{
@@ -2109,8 +2128,12 @@ private GameObject SpawnObject(NetworkObject prefabNetworkObject, NetworkManager
21092128
}
21102129

21112130
/// <summary>
2112-
/// Overloaded method <see cref="SpawnObjects(NetworkObject, NetworkManager, int, bool)"/>
2131+
/// Overloaded method <see cref="SpawnObjects(NetworkObject, NetworkManager, int, bool)"/>.
21132132
/// </summary>
2133+
/// <param name="prefabGameObject">the prefab <see cref="GameObject"/> to spawn</param>
2134+
/// <param name="owner">the owner of the instance</param>
2135+
/// <param name="count">number of instances to create and spawn</param>
2136+
/// <param name="destroyWithScene">default is false</param>
21142137
/// <returns>A <see cref="List{T}"/> of <see cref="GameObject"/>s spawned.</returns>
21152138
protected List<GameObject> SpawnObjects(GameObject prefabGameObject, NetworkManager owner, int count, bool destroyWithScene = false)
21162139
{
@@ -2123,7 +2146,7 @@ protected List<GameObject> SpawnObjects(GameObject prefabGameObject, NetworkMana
21232146
/// Will spawn (x) number of prefab NetworkObjects
21242147
/// <see cref="SpawnObject(NetworkObject, NetworkManager, bool)"/>
21252148
/// </summary>
2126-
/// <param name="prefabNetworkObject">the prefab NetworkObject to spawn</param>
2149+
/// <param name="prefabNetworkObject">the prefab <see cref="NetworkObject"/> to spawn</param>
21272150
/// <param name="owner">the owner of the instance</param>
21282151
/// <param name="count">number of instances to create and spawn</param>
21292152
/// <param name="destroyWithScene">default is false</param>
@@ -2220,6 +2243,11 @@ private void InitializeTestConfiguration(NetworkTopologyTypes networkTopologyTyp
22202243
/// Just a helper function to avoid having to write the entire assert just to check if you
22212244
/// timed out.
22222245
/// </summary>
2246+
/// <remarks>
2247+
/// If no <see cref="TimeoutHelper"/> is provided, then the <see cref="s_GlobalTimeoutHelper"/> will be used.
2248+
/// </remarks>
2249+
/// <param name="timeOutErrorMessage">The error message to log if a time out has occurred.</param>
2250+
/// <param name="assignedTimeoutHelper">Optional <see cref="TimeoutHelper"/> instance used during a conditional wait.</param>
22232251
protected void AssertOnTimeout(string timeOutErrorMessage, TimeoutHelper assignedTimeoutHelper = null)
22242252
{
22252253
var timeoutHelper = assignedTimeoutHelper ?? s_GlobalTimeoutHelper;
@@ -2299,6 +2327,8 @@ private IEnumerator WaitForTickAndFrames(NetworkManager networkManager, int tick
22992327
/// <summary>
23002328
/// Yields until specified amount of network ticks and the expected number of frames has been passed.
23012329
/// </summary>
2330+
/// <param name="networkManager">The relative <see cref="NetworkManager"/> waiting for a specific tick.</param>
2331+
/// <param name="count">How many ticks to wait for.</param>
23022332
/// <returns><see cref="IEnumerator"/></returns>
23032333
protected IEnumerator WaitForTicks(NetworkManager networkManager, int count)
23042334
{

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTestHelpers.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ public static void CleanUpHandlers()
175175
/// If deriving from <see cref="NetcodeIntegrationTest"/> or using <see cref="Destroy"/> then you
176176
/// typically won't need to call this.
177177
/// </summary>
178+
/// <param name="networkManager">The <see cref="NetworkManager"/> registering handlers.</param>
179+
/// <param name="serverSideSceneManager">When <see cref="true"/>, the <see cref="NetworkManager"/> will register as the scene manager handler.</param>
178180
public static void RegisterHandlers(NetworkManager networkManager, bool serverSideSceneManager = false)
179181
{
180182
SceneManagerValidationAndTestRunnerInitialization(networkManager);
@@ -546,6 +548,7 @@ internal static bool Start(bool host, bool startServer, NetworkManager server, N
546548
/// <param name="server">The Server NetworkManager</param>
547549
/// <param name="clients">The Clients NetworkManager</param>
548550
/// <param name="callback">called immediately after server is started and before client(s) are started</param>
551+
/// <param name="startServer">true to start it false to not start it.</param>
549552
/// <returns><see cref="true"/> if all instances started successfully, <see cref="false"/> otherwise</returns>
550553
public static bool Start(bool host, NetworkManager server, NetworkManager[] clients, BeforeClientStartCallback callback = null, bool startServer = true)
551554
{
@@ -608,8 +611,12 @@ public static bool Start(bool host, NetworkManager server, NetworkManager[] clie
608611
/// <summary>
609612
/// Used to return a value of type T from a wait condition
610613
/// </summary>
614+
/// <typeparam name="T">The type to wrap.</typeparam>
611615
public class ResultWrapper<T>
612616
{
617+
/// <summary>
618+
/// The result wrapped.
619+
/// </summary>
613620
public T Result;
614621
}
615622

@@ -850,6 +857,7 @@ public static IEnumerator WaitForClientConnectedToServer(NetworkManager server,
850857
/// Waits on the server side for 1 client to be connected
851858
/// </summary>
852859
/// <param name="server">The server</param>
860+
/// <param name="clientCount">The number of clients.</param>
853861
/// <param name="result">The result. If null, it will automatically assert</param>
854862
/// <param name="timeout">Maximum time in seconds to wait for connection. Defaults to DefaultTimeout</param>
855863
/// <returns><see cref="IEnumerator"/></returns>

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeLogAssert.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void LogWasNotReceived(LogType type, string message)
132132
/// Assert if a log message was logged with the expectation it would not be. (RegEx version)
133133
/// </summary>
134134
/// <param name="type"><see cref="LogType"/> to check for.</param>
135-
/// <param name="message"><see cref="Regex"/> containing the message pattern to search for.</param>
135+
/// <param name="messageRegex"><see cref="Regex"/> containing the message pattern to search for.</param>
136136
public void LogWasNotReceived(LogType type, Regex messageRegex)
137137
{
138138
lock (m_Lock)
@@ -177,7 +177,7 @@ public void LogWasReceived(LogType type, string message)
177177
/// Assert if a log message was not logged with the expectation that it would be. (RegEx version)
178178
/// </summary>
179179
/// <param name="type"><see cref="LogType"/> to check for.</param>
180-
/// <param name="message"><see cref="Regex"/> containing the message pattern to search for.</param>
180+
/// <param name="messageRegex"><see cref="Regex"/> containing the message pattern to search for.</param>
181181
public void LogWasReceived(LogType type, Regex messageRegex)
182182
{
183183
lock (m_Lock)

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetworkManagerHelper.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,32 @@ public static class NetworkManagerHelper
3838
/// All <see cref="NetworkObject"/> instances instantiated under the assigned <see cref="NetworkManager"/>.
3939
/// </summary>
4040
public static Dictionary<Guid, NetworkObject> InstantiatedNetworkObjects = new Dictionary<Guid, NetworkObject>();
41+
42+
/// <summary>
43+
/// The operation mode configured.
44+
/// </summary>
4145
public static NetworkManagerOperatingMode CurrentNetworkManagerMode;
4246

4347
/// <summary>
4448
/// This provides the ability to start NetworkManager in various modes
4549
/// </summary>
4650
public enum NetworkManagerOperatingMode
4751
{
52+
/// <summary>
53+
/// None
54+
/// </summary>
4855
None,
56+
/// <summary>
57+
/// Host mode
58+
/// </summary>
4959
Host,
60+
/// <summary>
61+
/// Server mode
62+
/// </summary>
5063
Server,
64+
/// <summary>
65+
/// Client mode
66+
/// </summary>
5167
Client,
5268
}
5369

@@ -58,6 +74,7 @@ public enum NetworkManagerOperatingMode
5874
/// send messages to yourself (i.e. Host-Client to Host-Server and vice versa).
5975
/// As such, the default setting is to start in Host mode.
6076
/// </summary>
77+
/// <param name="networkManager">The newly started <see cref="NetworkManager"/></param>
6178
/// <param name="managerMode">parameter to specify which mode you want to start the NetworkManager</param>
6279
/// <param name="networkConfig">parameter to specify custom NetworkConfig settings</param>
6380
/// <returns>true if it was instantiated or is already instantiate otherwise false means it failed to instantiate</returns>

0 commit comments

Comments
 (0)