Exemple #1
0
        public void MyTestMethod()
        {
            var scriptObject = new ScriptObject
            {
                LocalHierarchy =
                {
                    new KeyValuePair <string,                     HierarchyObject>("Child", new ScriptObject
                    {
                        AttachedScripts =
                        {
                            { "Script", new Script(new ImaginaryConstructableObject(typeof(TestScript)))                           },
                        },
                    }
                                                                                   ),
                },
            };

            Assert.IsNotNull(TestEvent.Instance.GetSubscribers(), "The Script wasn't subscribed to the TestEvent.");
            scriptObject.DestroyChild("Child");
            Assert.IsNull(TestEvent.Instance.GetSubscribers(),
                          "The Script wasn't unsubscribed from the TestEvent after it's HierarchyObject got removed.");
        }