public void can_wait_for_a_condition()
        {
            var hub = new MessagingHub();
            var listener = new RemoteListener(hub);

            var m1 = new Message(){Number = 1};
            var m2 = new Message() { Number = 2 };
            var m3 = new Message() { Number = 3 };
            var m4 = new Message() { Number = 4 };

            var result = listener.WaitForMessage<Message>(m => m.Number == 4, () => {
                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(100);
                    listener.SendObject(m1);
                    Thread.Sleep(100);
                    listener.SendObject(m2);
                    Thread.Sleep(100);
                    listener.SendObject(m3);
                    Thread.Sleep(100);
                    listener.SendObject(m4);
                });
            });

            result.ShouldBe(m4);
            hub.Listeners.Any().ShouldBeFalse(); // want it to remove the condition as it goes
        }
Esempio n. 2
0
 public ControlRoom(AbstractWeatherStation weatherStation)
 {
     RTControllerManagementThreads = new List <RadioTelescopeControllerManagementThread>();
     WeatherStation         = weatherStation;
     mobileControlServer    = new RemoteListener(80, this);
     weatherStationOverride = DatabaseOperations.GetOverrideStatusForSensor(SensorItemEnum.WEATHER_STATION);
 }
Esempio n. 3
0
        public void can_wait_for_a_condition()
        {
            var hub = new MessagingHub();
            var listener = new RemoteListener(hub);

            var m1 = new Message(){Number = 1};
            var m2 = new Message() { Number = 2 };
            var m3 = new Message() { Number = 3 };
            var m4 = new Message() { Number = 4 };

            var result = listener.WaitForMessage<Message>(m => m.Number == 4, () => {
                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(100);
                    listener.SendObject(m1);
                    Thread.Sleep(100);
                    listener.SendObject(m2);
                    Thread.Sleep(100);
                    listener.SendObject(m3);
                    Thread.Sleep(100);
                    listener.SendObject(m4);
                });
            });

            result.ShouldEqual(m4);
            hub.Listeners.Any().ShouldBeFalse(); // want it to remove the condition as it goes
        }
Esempio n. 4
0
        public void SetUp()
        {
            theListener = new RecordingListener();
            var hub = new MessagingHub();

            hub.AddListener(theListener);

            var remoteListener = new RemoteListener(hub);

            EventAggregator.Start(remoteListener);
        }
Esempio n. 5
0
        public void SetUp()
        {
            theListener = new RecordingListener();
            var hub = new MessagingHub();

            hub.AddListener(theListener);

            var remoteListener = new RemoteListener(hub);

            GlobalMessageTracking.Start(remoteListener);
        }
Esempio n. 6
0
        private void startUpAppDomain(RemoteDomainExpression expression)
        {
            AppDomainSetup setup = expression.Setup;

            _domain = AppDomain.CreateDomain(expression.Setup.ApplicationName, null, setup);

            expression.As <IAssemblyMover>().MoveAssemblies(setup);

            Type proxyType = typeof(RemoteServicesProxy);

            _proxy = (RemoteServicesProxy)
                     _domain.CreateInstanceAndUnwrap(proxyType.Assembly.FullName, proxyType.FullName);

            _remoteListener = new RemoteListener(_messagingHub);

            _proxy.Start(expression.BootstrapperName, expression.Properties.ToDictionary().As <Dictionary <string, string> >(),
                         _remoteListener);
        }