public IEnumerator UpdateStagesInvocation() { Guid updateStagesTestId = NetworkManagerHelper.AddGameNetworkObject("UpdateStagesTest"); var rpcPipelineTestComponent = NetworkManagerHelper.AddComponentToObject <NetworkUpdateStagesComponent>(updateStagesTestId); NetworkManagerHelper.SpawnNetworkObject(updateStagesTestId); var testsAreComplete = rpcPipelineTestComponent.IsTestComplete(); var exceededMaximumStageIterations = rpcPipelineTestComponent.ExceededMaxIterations(); // Start testing rpcPipelineTestComponent.EnableTesting = true; Debug.Log("Running TestNetworkUpdateStages: "); // Wait for the RPC pipeline test to complete or if we exceeded the maximum iterations bail while (!testsAreComplete && !exceededMaximumStageIterations) { yield return(new WaitForSeconds(0.003f)); testsAreComplete = rpcPipelineTestComponent.IsTestComplete(); Assert.IsFalse(rpcPipelineTestComponent.ExceededMaxIterations()); } var testsAreValidated = rpcPipelineTestComponent.ValidateUpdateStages(); // Stop testing rpcPipelineTestComponent.EnableTesting = false; Debug.Log($"Exiting status => {nameof(testsAreComplete)}: {testsAreComplete} - {nameof(testsAreValidated)}: {testsAreValidated} -{nameof(exceededMaximumStageIterations)}: {exceededMaximumStageIterations}"); Assert.IsTrue(testsAreComplete && testsAreValidated); // Disable this so it isn't running any longer. rpcPipelineTestComponent.gameObject.SetActive(false); }
public IEnumerator BufferDataValidation() { Guid gameObjectId = NetworkManagerHelper.AddGameNetworkObject("GrowingBufferObject"); var growingRpcBufferSizeComponent = NetworkManagerHelper.AddComponentToObject <BufferDataValidationComponent>(gameObjectId); NetworkManagerHelper.SpawnNetworkObject(gameObjectId); // Start Testing growingRpcBufferSizeComponent.EnableTesting = true; var testsAreComplete = growingRpcBufferSizeComponent.IsTestComplete(); // Wait for the RPC pipeline test to complete or if we exceeded the maximum iterations bail while (!testsAreComplete) { yield return(new WaitForSeconds(0.003f)); testsAreComplete = growingRpcBufferSizeComponent.IsTestComplete(); } // Stop Testing growingRpcBufferSizeComponent.EnableTesting = false; // Just disable this once we are done. growingRpcBufferSizeComponent.gameObject.SetActive(false); Assert.IsTrue(testsAreComplete); }
public IEnumerator TestAllNetworkVariableTypes() { Guid gameObjectId = NetworkManagerHelper.AddGameNetworkObject("NetworkVariableTestComponent"); var networkVariableTestComponent = NetworkManagerHelper.AddComponentToObject <NetworkVariableTestComponent>(gameObjectId); NetworkManagerHelper.SpawnNetworkObject(gameObjectId); // Start Testing networkVariableTestComponent.EnableTesting = true; var testsAreComplete = networkVariableTestComponent.IsTestComplete(); // Wait for the NetworkVariable tests to complete while (!testsAreComplete) { yield return(new WaitForSeconds(0.003f)); testsAreComplete = networkVariableTestComponent.IsTestComplete(); } // Stop Testing networkVariableTestComponent.EnableTesting = false; Assert.IsTrue(networkVariableTestComponent.DidAllValuesChange()); // Disable this once we are done. networkVariableTestComponent.gameObject.SetActive(false); Assert.IsTrue(testsAreComplete); }