예제 #1
0
        public void RemoveListener()
        {
            _context.Register(typeof(NonSharedComponent));

            var listener = new CountingCompositionListener();

            _context.RegisterCompositionListener("counter", listener);

            _context.GetComponent <ISampleContract>();
            _context.GetComponent <ISampleContract>();

            _context.UnregisterCompositionListener("counter");

            _context.GetComponent <ISampleContract>();
            _context.GetComponent <ISampleContract>();
            _context.GetComponent <ISampleContract>();

            Assert.AreEqual(2, listener.OnComponentCreatedCount);
            Assert.AreEqual(2, listener.OnComponentComposedCount);
            Assert.AreEqual(2, listener.OnComponentRetrievedCount);
        }