Esempio n. 1
0
        public void BlockTest_1()
        {
            // Setup and constants
            String name = "event0";
            IEvent ev   = new Event(name);

            Boolean           activated1  = false;
            ActivatorCallback onactivate1 = (self, signal) =>
            {
                activated1 = self.Blocking;
            };
            Boolean           activated2  = false;
            ActivatorCallback onactivate2 = (self, signal) =>
            {
                activated2 = true;
            };

            // Test proper
            IActivator sub1 = ev.Subscribe(onactivate1);
            IActivator sub2 = ev.Subscribe(onactivate2);

            sub1.SelfActivate = false; // sub1 blocking should always make sub1 get the signal.
            sub1.Block();
            sub1.Raise();

            // Assertions
            Assert.NotEqual(sub1.Name, sub2.Name);
            Assert.True(activated1);
            Assert.False(activated2);
        }