tests for ClientScene.UnregisterSpawnHandler (#1816)

This commit is contained in:
James Frowen 2020-04-29 23:29:00 +01:00 committed by GitHub
parent 28093f9072
commit 66728cdeef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,6 +150,38 @@ public void UnregisterPrefab_ErrorWhenPrefabHasNoNetworkIdentity()
}
[Test]
public void UnregisterSpawnHandler_RemovesSpawnHandlersFromDictionary()
{
spawnHandlers.Add(validPrefabGuid, new SpawnHandlerDelegate(x => null));
ClientScene.UnregisterSpawnHandler(validPrefabGuid);
Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid));
}
[Test]
public void UnregisterSpawnHandler_RemovesUnSpawnHandlersFromDictionary()
{
unspawnHandlers.Add(validPrefabGuid, new UnSpawnDelegate(x => { }));
ClientScene.UnregisterSpawnHandler(validPrefabGuid);
Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid));
}
[Test]
public void UnregisterSpawnHandler_DoesNotRemovePrefabDictionary()
{
prefabs.Add(validPrefabGuid, validPrefab);
ClientScene.UnregisterSpawnHandler(validPrefabGuid);
// Should not be removed
Assert.IsTrue(prefabs.ContainsKey(validPrefabGuid));
}
[Test]
public void ClearSpawners_RemovesAllPrefabsFromDictionary()
{