Ejemplo n.º 1
0
        public void RouteOneRegisteredMany()
        {
            var reset = new AutoResetEvent(false);

            QueryEvent a = null, b = null;

            System.Context.Route <QueryEvent>(e => a = e);
            System.Context.Route <QueryEvent>(e => b = e);

            IEvent fired = null;

            System.Context.Route <InformationEvent>(e => {
                fired = e;
                reset.Set();
            });

            AdminQuery.OnVerbose("Test Message");

            reset.WaitOne(300);

            Assert.IsNotNull(fired);
            Assert.IsInstanceOf <InformationEvent>(fired);

            Assert.IsNull(a);
            Assert.IsNull(b);

            var infoEvent = (InformationEvent)fired;

            Assert.AreEqual(InformationLevel.Verbose, infoEvent.Level);
            Assert.AreEqual("Test Message", infoEvent.Message);
        }
Ejemplo n.º 2
0
 private void OnQueryCommand(QueryEvent e)
 {
     lastCommandTime = e.TimeStamp;
     lastCommand = e.Query;
     lastCommandResult = e.Result;
 }