Пример #1
0
        public void Register7()
        {
            var gpi          = new GPI();
            var testNotifier = new TestNotifier <IGPI>();
            var assigner     = new Assigner <IGPI>(testNotifier);

            testNotifier.Add(gpi);

            var obj1          = new UnityEngine.GameObject();
            var testAdsorber1 = new TestAdsorber();


            assigner.Register(testAdsorber1);
            assigner.Unregister(testAdsorber1);

            var obj2          = new UnityEngine.GameObject();
            var testAdsorber2 = new TestAdsorber();


            assigner.Register(testAdsorber2);
            assigner.Unregister(testAdsorber2);


            testNotifier.Remove(gpi);

            Assert.AreEqual(1, testAdsorber1.SupplyCount);
            Assert.AreEqual(1, testAdsorber1.UnsupplyCount);
            Assert.AreEqual(1, testAdsorber2.SupplyCount);
            Assert.AreEqual(1, testAdsorber2.UnsupplyCount);
        }
Пример #2
0
        public void Register2()
        {
            var gpi          = new GPI();
            var testNotifier = new TestNotifier <IGPI>();
            var assigner     = new Assigner <IGPI>(testNotifier);

            var obj          = new UnityEngine.GameObject();
            var testAdsorber = new TestAdsorber();

            assigner.Register(testAdsorber);

            testNotifier.Add(gpi);

            assigner.Unregister(testAdsorber);
            assigner.Register(testAdsorber);

            Assert.AreEqual(2, testAdsorber.SupplyCount);
        }