Exemplo n.º 1
0
        public void EstablishContext()
        {
            _serviceStarted = new FutureChannel <ServiceRunning>();
            _service        = new TestService();
            _hostChannel    = new TestChannel();

            _coordinator = new Model.ServiceCoordinator();

            var b = new LocalServiceBuilder <TestService>(null, _serviceName, (d, name, coordinator) => _service,
                                                          x => x.Start(), x => x.Stop(), x => { }, x => { });


            _controllerFactory = new ServiceControllerFactory();
            _factory           = _controllerFactory.CreateFactory(inbox => b.Build(inbox, _coordinator));
            _instance          = _factory.GetActor();

            _hostChannel.Connect(x =>
            {
                x.AddChannel(_instance);

                x.AddChannel(_serviceStarted);
            });

            _coordinator.Send(new CreateService(_serviceName));
            _coordinator.Send(new StartService(_serviceName));

            _serviceStarted.WaitUntilCompleted(5.Seconds());
        }
Exemplo n.º 2
0
        public void Should_start_the_shelf_in_the_separate_app_domain()
        {
            _log.Debug("Starting up the controller");

            using (var coordinator = new Model.ServiceCoordinator())
            {
                coordinator.Start();
                coordinator.Send(new CreateShelfService("bob", ShelfType.Folder, typeof(TestAppDomainBootsrapper)));

                TestAppDomainBootsrapper.Started.WaitOne(20.Seconds()).ShouldBeTrue();
            }
        }
Exemplo n.º 3
0
        public void Should_stop_the_shelf_in_the_separate_app_domain()
        {
            using (var coordinator = new Model.ServiceCoordinator())
            {
                coordinator.Start();
                coordinator.Send(new CreateShelfService("bob", ShelfType.Internal, typeof(TestAppDomainBootsrapper)));

                TestAppDomainBootsrapper.Started.WaitOne(20.Seconds()).ShouldBeTrue();
            }

            TestAppDomainBootsrapper.Stopped.WaitOne(20.Seconds()).ShouldBeTrue();
        }