This commit is contained in:
vis2k 2021-03-07 19:43:41 +08:00
parent 396fc4542b
commit 0bc2a5573f
9 changed files with 47 additions and 47 deletions

View File

@ -12,7 +12,7 @@ public void RemovesAllPrefabsFromDictionary()
prefabs.Add(Guid.NewGuid(), null); prefabs.Add(Guid.NewGuid(), null);
prefabs.Add(Guid.NewGuid(), null); prefabs.Add(Guid.NewGuid(), null);
ClientScene.ClearSpawners(); NetworkClient.ClearSpawners();
Assert.IsEmpty(prefabs); Assert.IsEmpty(prefabs);
} }
@ -24,7 +24,7 @@ public void RemovesAllSpawnHandlersFromDictionary()
spawnHandlers.Add(Guid.NewGuid(), null); spawnHandlers.Add(Guid.NewGuid(), null);
spawnHandlers.Add(Guid.NewGuid(), null); spawnHandlers.Add(Guid.NewGuid(), null);
ClientScene.ClearSpawners(); NetworkClient.ClearSpawners();
Assert.IsEmpty(spawnHandlers); Assert.IsEmpty(spawnHandlers);
} }
@ -36,7 +36,7 @@ public void RemovesAllUnspawnHandlersFromDictionary()
unspawnHandlers.Add(Guid.NewGuid(), null); unspawnHandlers.Add(Guid.NewGuid(), null);
unspawnHandlers.Add(Guid.NewGuid(), null); unspawnHandlers.Add(Guid.NewGuid(), null);
ClientScene.ClearSpawners(); NetworkClient.ClearSpawners();
Assert.IsEmpty(unspawnHandlers); Assert.IsEmpty(unspawnHandlers);
} }
@ -56,7 +56,7 @@ public void ClearsAllDictionary()
unspawnHandlers.Add(Guid.NewGuid(), null); unspawnHandlers.Add(Guid.NewGuid(), null);
unspawnHandlers.Add(Guid.NewGuid(), null); unspawnHandlers.Add(Guid.NewGuid(), null);
ClientScene.ClearSpawners(); NetworkClient.ClearSpawners();
Assert.IsEmpty(prefabs); Assert.IsEmpty(prefabs);
Assert.IsEmpty(spawnHandlers); Assert.IsEmpty(spawnHandlers);

View File

@ -9,7 +9,7 @@ public class ClientSceneTests_GetPrefab : ClientSceneTestsBase
[Test] [Test]
public void ReturnsFalseForEmptyGuid() public void ReturnsFalseForEmptyGuid()
{ {
bool result = ClientScene.GetPrefab(new Guid(), out GameObject prefab); bool result = NetworkClient.GetPrefab(new Guid(), out GameObject prefab);
Assert.IsFalse(result); Assert.IsFalse(result);
Assert.IsNull(prefab); Assert.IsNull(prefab);
@ -19,7 +19,7 @@ public void ReturnsFalseForEmptyGuid()
public void ReturnsFalseForPrefabNotFound() public void ReturnsFalseForPrefabNotFound()
{ {
Guid guid = Guid.NewGuid(); Guid guid = Guid.NewGuid();
bool result = ClientScene.GetPrefab(guid, out GameObject prefab); bool result = NetworkClient.GetPrefab(guid, out GameObject prefab);
Assert.IsFalse(result); Assert.IsFalse(result);
Assert.IsNull(prefab); Assert.IsNull(prefab);
@ -30,7 +30,7 @@ public void ReturnsFalseForPrefabIsNull()
{ {
Guid guid = Guid.NewGuid(); Guid guid = Guid.NewGuid();
prefabs.Add(guid, null); prefabs.Add(guid, null);
bool result = ClientScene.GetPrefab(guid, out GameObject prefab); bool result = NetworkClient.GetPrefab(guid, out GameObject prefab);
Assert.IsFalse(result); Assert.IsFalse(result);
Assert.IsNull(prefab); Assert.IsNull(prefab);
@ -40,7 +40,7 @@ public void ReturnsFalseForPrefabIsNull()
public void ReturnsTrueWhenPrefabIsFound() public void ReturnsTrueWhenPrefabIsFound()
{ {
prefabs.Add(validPrefabGuid, validPrefab); prefabs.Add(validPrefabGuid, validPrefab);
bool result = ClientScene.GetPrefab(validPrefabGuid, out GameObject prefab); bool result = NetworkClient.GetPrefab(validPrefabGuid, out GameObject prefab);
Assert.IsTrue(result); Assert.IsTrue(result);
Assert.NotNull(prefab); Assert.NotNull(prefab);
@ -50,7 +50,7 @@ public void ReturnsTrueWhenPrefabIsFound()
public void HasOutPrefabWithCorrectGuid() public void HasOutPrefabWithCorrectGuid()
{ {
prefabs.Add(validPrefabGuid, validPrefab); prefabs.Add(validPrefabGuid, validPrefab);
ClientScene.GetPrefab(validPrefabGuid, out GameObject prefab); NetworkClient.GetPrefab(validPrefabGuid, out GameObject prefab);
Assert.NotNull(prefab); Assert.NotNull(prefab);

View File

@ -608,7 +608,7 @@ public void ApplyPayload_SendsDataToNetworkBehaviourDeserialize()
[Test] [Test]
public void ApplyPayload_LocalPlayerAddsIdentityToConnection() public void ApplyPayload_LocalPlayerAddsIdentityToConnection()
{ {
Debug.Assert(ClientScene.localPlayer == null, "LocalPlayer should be null before this test"); Debug.Assert(NetworkClient.localPlayer == null, "LocalPlayer should be null before this test");
const uint netId = 1000; const uint netId = 1000;
GameObject go = new GameObject(); GameObject go = new GameObject();
@ -631,19 +631,19 @@ public void ApplyPayload_LocalPlayerAddsIdentityToConnection()
payload = default, payload = default,
}; };
PropertyInfo readyConnProperty = typeof(ClientScene).GetProperty(nameof(ClientScene.readyConnection)); PropertyInfo readyConnProperty = typeof(ClientScene).GetProperty(nameof(NetworkClient.readyConnection));
readyConnProperty.SetValue(null, new FakeNetworkConnection()); readyConnProperty.SetValue(null, new FakeNetworkConnection());
NetworkClient.ApplySpawnPayload(identity, msg); NetworkClient.ApplySpawnPayload(identity, msg);
Assert.That(ClientScene.localPlayer, Is.EqualTo(identity)); Assert.That(NetworkClient.localPlayer, Is.EqualTo(identity));
Assert.That(ClientScene.readyConnection.identity, Is.EqualTo(identity)); Assert.That(NetworkClient.readyConnection.identity, Is.EqualTo(identity));
} }
[Test] [Test]
public void ApplyPayload_LocalPlayerWarningWhenNoReadyConnection() public void ApplyPayload_LocalPlayerWarningWhenNoReadyConnection()
{ {
Debug.Assert(ClientScene.localPlayer == null, "LocalPlayer should be null before this test"); Debug.Assert(NetworkClient.localPlayer == null, "LocalPlayer should be null before this test");
const uint netId = 1000; const uint netId = 1000;
GameObject go = new GameObject(); GameObject go = new GameObject();
@ -670,7 +670,7 @@ public void ApplyPayload_LocalPlayerWarningWhenNoReadyConnection()
LogAssert.Expect(LogType.Warning, "No ready connection found for setting player controller during InternalAddPlayer"); LogAssert.Expect(LogType.Warning, "No ready connection found for setting player controller during InternalAddPlayer");
NetworkClient.ApplySpawnPayload(identity, msg); NetworkClient.ApplySpawnPayload(identity, msg);
Assert.That(ClientScene.localPlayer, Is.EqualTo(identity)); Assert.That(NetworkClient.localPlayer, Is.EqualTo(identity));
} }
[Flags] [Flags]

View File

@ -31,7 +31,7 @@ public void AddsAllInactiveIdentitiesInSceneWithSceneIdToDictionary()
obj3.gameObject.SetActive(false); obj3.gameObject.SetActive(false);
obj4.gameObject.SetActive(false); obj4.gameObject.SetActive(false);
ClientScene.PrepareToSpawnSceneObjects(); NetworkClient.PrepareToSpawnSceneObjects();
Assert.That(spawnableObjects, Has.Count.EqualTo(4)); Assert.That(spawnableObjects, Has.Count.EqualTo(4));
@ -54,7 +54,7 @@ public void DoesNotAddActiveObjectsToDictionary()
inactive1.gameObject.SetActive(false); inactive1.gameObject.SetActive(false);
inactive2.gameObject.SetActive(false); inactive2.gameObject.SetActive(false);
ClientScene.PrepareToSpawnSceneObjects(); NetworkClient.PrepareToSpawnSceneObjects();
Assert.That(spawnableObjects, Has.Count.EqualTo(2)); Assert.That(spawnableObjects, Has.Count.EqualTo(2));
@ -78,7 +78,7 @@ public void DoesNotAddObjectsWithNoSceneId()
hasId1.gameObject.SetActive(false); hasId1.gameObject.SetActive(false);
hasId2.gameObject.SetActive(false); hasId2.gameObject.SetActive(false);
ClientScene.PrepareToSpawnSceneObjects(); NetworkClient.PrepareToSpawnSceneObjects();
Assert.IsTrue(spawnableObjects.ContainsValue(hasId1)); Assert.IsTrue(spawnableObjects.ContainsValue(hasId1));
Assert.IsTrue(spawnableObjects.ContainsValue(hasId2)); Assert.IsTrue(spawnableObjects.ContainsValue(hasId2));
@ -95,7 +95,7 @@ public void AddsIdentitiesToDictionaryUsingSceneId()
obj1.gameObject.SetActive(false); obj1.gameObject.SetActive(false);
obj2.gameObject.SetActive(false); obj2.gameObject.SetActive(false);
ClientScene.PrepareToSpawnSceneObjects(); NetworkClient.PrepareToSpawnSceneObjects();
Assert.IsTrue(spawnableObjects.ContainsKey(20)); Assert.IsTrue(spawnableObjects.ContainsKey(20));
Assert.That(spawnableObjects[20], Is.EqualTo(obj1)); Assert.That(spawnableObjects[20], Is.EqualTo(obj1));
@ -119,7 +119,7 @@ public void ClearsExistingItemsFromDictionary()
NetworkIdentity obj2 = CreateSceneObject(63); NetworkIdentity obj2 = CreateSceneObject(63);
obj2.gameObject.SetActive(false); obj2.gameObject.SetActive(false);
ClientScene.PrepareToSpawnSceneObjects(); NetworkClient.PrepareToSpawnSceneObjects();
Assert.That(spawnableObjects, Has.Count.EqualTo(1)); Assert.That(spawnableObjects, Has.Count.EqualTo(1));
Assert.IsFalse(spawnableObjects.ContainsValue(null)); Assert.IsFalse(spawnableObjects.ContainsValue(null));

View File

@ -20,7 +20,7 @@ public void SpawnDelegate_AddsHandlerToSpawnHandlers()
}); });
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
Assert.IsTrue(spawnHandlers.ContainsKey(guid)); Assert.IsTrue(spawnHandlers.ContainsKey(guid));
@ -46,7 +46,7 @@ public void SpawnDelegate_AddsHandlerToSpawnHandlersWithCorrectArguments()
}); });
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
Assert.IsTrue(spawnHandlers.ContainsKey(guid)); Assert.IsTrue(spawnHandlers.ContainsKey(guid));
@ -63,7 +63,7 @@ public void SpawnDelegate_AddsHandlerToUnSpawnHandlers()
SpawnDelegate spawnHandler = new SpawnDelegate((x, y) => null); SpawnDelegate spawnHandler = new SpawnDelegate((x, y) => null);
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
Assert.IsTrue(unspawnHandlers.ContainsKey(guid)); Assert.IsTrue(unspawnHandlers.ContainsKey(guid));
Assert.AreEqual(unspawnHandlers[guid], unspawnHandler); Assert.AreEqual(unspawnHandlers[guid], unspawnHandler);
@ -77,7 +77,7 @@ public void SpawnDelegate_ErrorWhenSpawnHandlerIsNull()
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
LogAssert.Expect(LogType.Error, $"Can not Register null SpawnHandler for {guid}"); LogAssert.Expect(LogType.Error, $"Can not Register null SpawnHandler for {guid}");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
[Test] [Test]
@ -88,7 +88,7 @@ public void SpawnDelegate_ErrorWhenUnSpawnHandlerIsNull()
UnSpawnDelegate unspawnHandler = null; UnSpawnDelegate unspawnHandler = null;
LogAssert.Expect(LogType.Error, $"Can not Register null UnSpawnHandler for {guid}"); LogAssert.Expect(LogType.Error, $"Can not Register null UnSpawnHandler for {guid}");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
[Test] [Test]
@ -99,7 +99,7 @@ public void SpawnDelegate_ErrorWhenAssetIdIsEmpty()
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
LogAssert.Expect(LogType.Error, "Can not Register SpawnHandler for empty Guid"); LogAssert.Expect(LogType.Error, "Can not Register SpawnHandler for empty Guid");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
[Test] [Test]
@ -109,13 +109,13 @@ public void SpawnDelegate_WarningWhenHandlerForGuidAlreadyExistsInHandlerDiction
SpawnDelegate spawnHandler = new SpawnDelegate((x, y) => null); SpawnDelegate spawnHandler = new SpawnDelegate((x, y) => null);
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
SpawnDelegate spawnHandler2 = new SpawnDelegate((x, y) => new GameObject()); SpawnDelegate spawnHandler2 = new SpawnDelegate((x, y) => new GameObject());
UnSpawnDelegate unspawnHandler2 = new UnSpawnDelegate(x => UnityEngine.Object.Destroy(x)); UnSpawnDelegate unspawnHandler2 = new UnSpawnDelegate(x => UnityEngine.Object.Destroy(x));
LogAssert.Expect(LogType.Warning, $"Replacing existing spawnHandlers for {guid}"); LogAssert.Expect(LogType.Warning, $"Replacing existing spawnHandlers for {guid}");
ClientScene.RegisterSpawnHandler(guid, spawnHandler2, unspawnHandler2); NetworkClient.RegisterSpawnHandler(guid, spawnHandler2, unspawnHandler2);
} }
[Test] [Test]
@ -128,7 +128,7 @@ public void SpawnDelegate_ErrorWhenHandlerForGuidAlreadyExistsInPrefabDictionary
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
LogAssert.Expect(LogType.Error, $"assetId '{guid}' is already used by prefab '{validPrefab.name}'"); LogAssert.Expect(LogType.Error, $"assetId '{guid}' is already used by prefab '{validPrefab.name}'");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
@ -139,7 +139,7 @@ public void SpawnHandlerDelegate_AddsHandlerToSpawnHandlers()
SpawnHandlerDelegate spawnHandler = new SpawnHandlerDelegate(x => null); SpawnHandlerDelegate spawnHandler = new SpawnHandlerDelegate(x => null);
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
Assert.IsTrue(spawnHandlers.ContainsKey(guid)); Assert.IsTrue(spawnHandlers.ContainsKey(guid));
Assert.AreEqual(spawnHandlers[guid], spawnHandler); Assert.AreEqual(spawnHandlers[guid], spawnHandler);
@ -152,7 +152,7 @@ public void SpawnHandlerDelegate_AddsHandlerToUnSpawnHandlers()
SpawnHandlerDelegate spawnHandler = new SpawnHandlerDelegate(x => null); SpawnHandlerDelegate spawnHandler = new SpawnHandlerDelegate(x => null);
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
Assert.IsTrue(unspawnHandlers.ContainsKey(guid)); Assert.IsTrue(unspawnHandlers.ContainsKey(guid));
Assert.AreEqual(unspawnHandlers[guid], unspawnHandler); Assert.AreEqual(unspawnHandlers[guid], unspawnHandler);
@ -166,7 +166,7 @@ public void SpawnHandlerDelegate_ErrorWhenSpawnHandlerIsNull()
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
LogAssert.Expect(LogType.Error, $"Can not Register null SpawnHandler for {guid}"); LogAssert.Expect(LogType.Error, $"Can not Register null SpawnHandler for {guid}");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
[Test] [Test]
@ -177,7 +177,7 @@ public void SpawnHandlerDelegate_ErrorWhenUnSpawnHandlerIsNull()
UnSpawnDelegate unspawnHandler = null; UnSpawnDelegate unspawnHandler = null;
LogAssert.Expect(LogType.Error, $"Can not Register null UnSpawnHandler for {guid}"); LogAssert.Expect(LogType.Error, $"Can not Register null UnSpawnHandler for {guid}");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
[Test] [Test]
@ -188,7 +188,7 @@ public void SpawnHandlerDelegate_ErrorWhenAssetIdIsEmpty()
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
LogAssert.Expect(LogType.Error, "Can not Register SpawnHandler for empty Guid"); LogAssert.Expect(LogType.Error, "Can not Register SpawnHandler for empty Guid");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
[Test] [Test]
@ -198,13 +198,13 @@ public void SpawnHandlerDelegate_WarningWhenHandlerForGuidAlreadyExistsInHandler
SpawnHandlerDelegate spawnHandler = new SpawnHandlerDelegate(x => null); SpawnHandlerDelegate spawnHandler = new SpawnHandlerDelegate(x => null);
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {}); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => {});
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
SpawnHandlerDelegate spawnHandler2 = new SpawnHandlerDelegate(x => new GameObject()); SpawnHandlerDelegate spawnHandler2 = new SpawnHandlerDelegate(x => new GameObject());
UnSpawnDelegate unspawnHandler2 = new UnSpawnDelegate(x => UnityEngine.Object.Destroy(x)); UnSpawnDelegate unspawnHandler2 = new UnSpawnDelegate(x => UnityEngine.Object.Destroy(x));
LogAssert.Expect(LogType.Warning, $"Replacing existing spawnHandlers for {guid}"); LogAssert.Expect(LogType.Warning, $"Replacing existing spawnHandlers for {guid}");
ClientScene.RegisterSpawnHandler(guid, spawnHandler2, unspawnHandler2); NetworkClient.RegisterSpawnHandler(guid, spawnHandler2, unspawnHandler2);
} }
[Test] [Test]
@ -217,7 +217,7 @@ public void SpawnHandlerDelegate_ErrorWhenHandlerForGuidAlreadyExistsInPrefabDic
UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => UnityEngine.Object.Destroy(x)); UnSpawnDelegate unspawnHandler = new UnSpawnDelegate(x => UnityEngine.Object.Destroy(x));
LogAssert.Expect(LogType.Error, $"assetId '{guid}' is already used by prefab '{validPrefab.name}'"); LogAssert.Expect(LogType.Error, $"assetId '{guid}' is already used by prefab '{validPrefab.name}'");
ClientScene.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler); NetworkClient.RegisterSpawnHandler(guid, spawnHandler, unspawnHandler);
} }
} }

View File

@ -11,7 +11,7 @@ public void RemovesPrefabFromDictionary()
{ {
prefabs.Add(validPrefabGuid, validPrefab); prefabs.Add(validPrefabGuid, validPrefab);
ClientScene.UnregisterPrefab(validPrefab); NetworkClient.UnregisterPrefab(validPrefab);
Assert.IsFalse(prefabs.ContainsKey(validPrefabGuid)); Assert.IsFalse(prefabs.ContainsKey(validPrefabGuid));
} }
@ -21,7 +21,7 @@ public void RemovesSpawnHandlerFromDictionary()
{ {
spawnHandlers.Add(validPrefabGuid, new SpawnHandlerDelegate(x => null)); spawnHandlers.Add(validPrefabGuid, new SpawnHandlerDelegate(x => null));
ClientScene.UnregisterPrefab(validPrefab); NetworkClient.UnregisterPrefab(validPrefab);
Assert.IsFalse(spawnHandlers.ContainsKey(validPrefabGuid)); Assert.IsFalse(spawnHandlers.ContainsKey(validPrefabGuid));
} }
@ -31,7 +31,7 @@ public void RemovesUnSpawnHandlerFromDictionary()
{ {
unspawnHandlers.Add(validPrefabGuid, new UnSpawnDelegate(x => {})); unspawnHandlers.Add(validPrefabGuid, new UnSpawnDelegate(x => {}));
ClientScene.UnregisterPrefab(validPrefab); NetworkClient.UnregisterPrefab(validPrefab);
Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid)); Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid));
} }
@ -40,14 +40,14 @@ public void RemovesUnSpawnHandlerFromDictionary()
public void ErrorWhenPrefabIsNull() public void ErrorWhenPrefabIsNull()
{ {
LogAssert.Expect(LogType.Error, "Could not unregister prefab because it was null"); LogAssert.Expect(LogType.Error, "Could not unregister prefab because it was null");
ClientScene.UnregisterPrefab(null); NetworkClient.UnregisterPrefab(null);
} }
[Test] [Test]
public void ErrorWhenPrefabHasNoNetworkIdentity() public void ErrorWhenPrefabHasNoNetworkIdentity()
{ {
LogAssert.Expect(LogType.Error, $"Could not unregister '{invalidPrefab.name}' since it contains no NetworkIdentity component"); LogAssert.Expect(LogType.Error, $"Could not unregister '{invalidPrefab.name}' since it contains no NetworkIdentity component");
ClientScene.UnregisterPrefab(invalidPrefab); NetworkClient.UnregisterPrefab(invalidPrefab);
} }
} }

View File

@ -9,7 +9,7 @@ public void RemovesSpawnHandlersFromDictionary()
{ {
spawnHandlers.Add(validPrefabGuid, new SpawnHandlerDelegate(x => null)); spawnHandlers.Add(validPrefabGuid, new SpawnHandlerDelegate(x => null));
ClientScene.UnregisterSpawnHandler(validPrefabGuid); NetworkClient.UnregisterSpawnHandler(validPrefabGuid);
Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid)); Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid));
} }
@ -19,7 +19,7 @@ public void RemovesUnSpawnHandlersFromDictionary()
{ {
unspawnHandlers.Add(validPrefabGuid, new UnSpawnDelegate(x => {})); unspawnHandlers.Add(validPrefabGuid, new UnSpawnDelegate(x => {}));
ClientScene.UnregisterSpawnHandler(validPrefabGuid); NetworkClient.UnregisterSpawnHandler(validPrefabGuid);
Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid)); Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid));
} }
@ -29,7 +29,7 @@ public void DoesNotRemovePrefabDictionary()
{ {
prefabs.Add(validPrefabGuid, validPrefab); prefabs.Add(validPrefabGuid, validPrefab);
ClientScene.UnregisterSpawnHandler(validPrefabGuid); NetworkClient.UnregisterSpawnHandler(validPrefabGuid);
// Should not be removed // Should not be removed
Assert.IsTrue(prefabs.ContainsKey(validPrefabGuid)); Assert.IsTrue(prefabs.ContainsKey(validPrefabGuid));

View File

@ -367,7 +367,7 @@ public void SendCommandInternal()
Assert.That(comp.called, Is.EqualTo(0)); Assert.That(comp.called, Is.EqualTo(0));
// clientscene.readyconnection needs to be set for commands // clientscene.readyconnection needs to be set for commands
ClientScene.Ready(connection.connectionToServer); NetworkClient.Ready(connection.connectionToServer);
// call command // call command
comp.CallSendCommandInternal(); comp.CallSendCommandInternal();

View File

@ -23,7 +23,7 @@ public void Setup()
NetworkServer.localConnection.isAuthenticated = true; NetworkServer.localConnection.isAuthenticated = true;
NetworkClient.connection.isAuthenticated = true; NetworkClient.connection.isAuthenticated = true;
ClientScene.Ready(NetworkClient.connection); NetworkClient.Ready(NetworkClient.connection);
} }
[TearDown] [TearDown]