This repository was archived by the owner on Jan 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +31
-2
lines changed
workers/unity/Assets/Tests/EditmodeTests/Correctness/Subscriptions Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,35 @@ public void SubscriptionSystem_invokes_callback_on_receiving_response()
4040 } ) ;
4141 }
4242
43+ [ Test ]
44+ public void SubscriptionSystem_does_not_invoke_callback_when_gameobject_is_unlinked ( )
45+ {
46+ World . Step ( world =>
47+ {
48+ world . Connection . CreateEntity ( EntityId , GetTemplate ( ) ) ;
49+ } )
50+ . Step ( world =>
51+ {
52+ return world . CreateGameObject < CommandStub > ( EntityId ) . Item2 ;
53+ } )
54+ . Step ( ( world , mono ) =>
55+ {
56+ mono . Sender . SendTestCommand ( GetRequest ( ) , response => throw new AssertionException ( "Don't call" ) ) ;
57+ } )
58+ . Step ( ( world , mono ) =>
59+ {
60+ world . Linker . UnlinkGameObjectFromEntity ( new EntityId ( EntityId ) , mono . gameObject ) ;
61+ } )
62+ . Step ( world =>
63+ {
64+ world . Connection . GenerateResponses < TestCommands . Test . Request , TestCommands . Test . ReceivedResponse > ( ResponseGenerator ) ;
65+ } )
66+ . Step ( ( world , mono ) =>
67+ {
68+ Assert . IsFalse ( mono . enabled ) ;
69+ } ) ;
70+ }
71+
4372 private static TestCommands . Test . ReceivedResponse ResponseGenerator ( CommandRequestId id , TestCommands . Test . Request request )
4473 {
4574 return new TestCommands . Test . ReceivedResponse (
@@ -57,8 +86,8 @@ private static TestCommands.Test.ReceivedResponse ResponseGenerator(CommandReque
5786 private static EntityTemplate GetTemplate ( )
5887 {
5988 var template = new EntityTemplate ( ) ;
60- template . AddComponent ( new Position . Snapshot ( ) , "worker" ) ;
61- template . AddComponent ( new TestCommands . Snapshot ( ) , "worker" ) ;
89+ template . AddComponent ( new Position . Snapshot ( ) ) ;
90+ template . AddComponent ( new TestCommands . Snapshot ( ) ) ;
6291 return template ;
6392 }
6493
You can’t perform that action at this time.
0 commit comments