示例#1
0
        public void Send_Dynamic_Message_And_Read_With_Anonymous_In_Memory()
        {
            var bus = new Ariane.BusManager();

            var person = bus.CreateMessage("person");

            person.IsProcessed = false;

            var mre = new ManualResetEvent(false);

            bus.Register.AddMemoryReader <System.Dynamic.ExpandoObject>("dynamicperson", (o) =>
            {
                var p         = o as dynamic;
                p.IsProcessed = true;
                mre.Set();
            });

            bus.Send("dynamicperson", person);
            bus.StartReading("dynamicperson");

            mre.WaitOne(10 * 1000);

            Assert.AreEqual(true, person.IsProcessed);

            bus.StopReading();
            bus.Dispose();
        }
示例#2
0
        public void Send_And_Read_With_Anonymous_In_Memory()
        {
            var mre = new ManualResetEvent(false);
            var bus = new Ariane.BusManager();

            bus.Register.AddMemoryReader <Person>("person", (p) =>
            {
                p.IsProcessed = true;
                mre.Set();
            });

            var person = Person.CreateTestPerson();

            bus.Send("person", person);
            bus.StartReading("person");

            mre.WaitOne(2 * 1000);

            Check.That(person.IsProcessed).IsTrue();

            bus.StopReading();
            bus.Dispose();
        }