Ejemplo n.º 1
0
        public void TestPostOneRegisterdClass()
        {
            PostTestClass c = new PostTestClass();

            Assert.AreEqual(c.StartedCounter, 0, "The method counter isn't correct");

            testObject.Register(c);
            testObject.Post("Started");
            Assert.AreEqual(c.StartedCounter, 1, "The method counter isn't correct");
        }
Ejemplo n.º 2
0
        public void TestUnregisterDuringPost()
        {
            PostTestClass c0 = new PostTestClass();
            UnregisterDuringPostTestClass u1 = new UnregisterDuringPostTestClass();

            u1.EventBus = testObject;
            PostTestClass c1 = new PostTestClass();

            Assert.AreEqual(c0.UnregisterEventCounter, 0, "The method counter isn't correct");
            Assert.AreEqual(c1.UnregisterEventCounter, 0, "The method counter isn't correct");

            testObject.Register(c0);
            testObject.Register(u1);
            Assert.IsTrue(testObject.IsRegistered(u1), "The given class isn't registerd");
            testObject.Register(c1);
            testObject.Post("UnregisterEvent");
            Assert.AreEqual(c0.UnregisterEventCounter, 1, "The method counter isn't correct");
            Assert.IsFalse(testObject.IsRegistered(u1), "The given class is registerd");
            Assert.AreEqual(c1.UnregisterEventCounter, 1, "The method counter isn't correct");
        }