public void TestModuleWhichImplementsInterface()
        {
            MockModuleImplementingInterface module = new MockModuleImplementingInterface();
            ModuleCoordinator coordinator = new ModuleCoordinator();
            coordinator.AddModule("TestModule", module);
            coordinator.StartAll();
            coordinator.PostMessage("TestModule", "TestMessage");
            coordinator.PostMessage("TestModule", 77);
            System.Threading.Thread.Sleep(100);
            coordinator.StopAll();

            Assert.AreSame(coordinator, module.ModuleCoordinator);
            Assert.AreEqual(2, module.ReceivedMessages.Count);
            Assert.IsInstanceOfType(typeof(string), module.ReceivedMessages[0]);
            Assert.AreEqual("TestMessage", (string)module.ReceivedMessages[0]);

            Assert.IsInstanceOfType(typeof(int), module.ReceivedMessages[1]);
            Assert.AreEqual(77, (int)module.ReceivedMessages[1]);
        }
Пример #2
0
        public void TestModuleWhichImplementsInterface()
        {
            MockModuleImplementingInterface module = new MockModuleImplementingInterface();
            ModuleCoordinator coordinator          = new ModuleCoordinator();

            coordinator.AddModule("TestModule", module);
            coordinator.StartAll();
            coordinator.PostMessage("TestModule", "TestMessage");
            coordinator.PostMessage("TestModule", 77);
            System.Threading.Thread.Sleep(100);
            coordinator.StopAll();

            Assert.AreSame(coordinator, module.ModuleCoordinator);
            Assert.AreEqual(2, module.ReceivedMessages.Count);
            Assert.IsInstanceOfType(typeof(string), module.ReceivedMessages[0]);
            Assert.AreEqual("TestMessage", (string)module.ReceivedMessages[0]);

            Assert.IsInstanceOfType(typeof(int), module.ReceivedMessages[1]);
            Assert.AreEqual(77, (int)module.ReceivedMessages[1]);
        }