Пример #1
0
        public void TestMethod1()
        {
            var processA =  new SomeProcess("test_process_a");
            var processB =  new SomeProcess("test_process_b");

            //initilize broker
            Bus.Uri = new Uri("amqp://*****:*****@localhost/");

            //register process so that they can communicate
            Bus.RegisterProcess(processA);
            Bus.RegisterProcess(processB);

            //init broker asynchronously
            Bus.Init();

            Thread.Sleep(1000);

            //SendMessage is acynchronus message, so we have to wait until the second party gets the message
            processA.SendMessage("test_process_b", "hello!");

            Thread.Sleep(1000);

            //stop bus asynchronously
            Bus.Close();

            Thread.Sleep(10000);
            Assert.IsTrue(processB.ReceivedAsync);

            //Assert.IsTrue(process.Disconnected);
        }
Пример #2
0
        public void TestMethod1()
        {
            var process =   new SomeProcess("test_process");

            //initilize broker
            Bus.Uri  =   new Uri("amqp://*****:*****@localhost/");

            //register business logic process in the broker
            Bus.RegisterProcess(process);

            //init broker asynchronously
            Bus.Init();
            //stop bus asynchronously
            Bus.Close();

            Thread.Sleep(10000);
            Assert.IsTrue(process.Connected);

            Assert.IsTrue(process.Disconnected);
        }