public void SetUp()
        {
            _standardComponents = CreateStandardComponents();

            Subsystem = new ProjectionsSubsystem(1, ProjectionType.All, true, TimeSpan.FromSeconds(3), true);
            Subsystem.Register(_standardComponents);

            // Unsubscribe from the actual components so we can test in isolation
            Subsystem.MasterMainBus.Unsubscribe <ProjectionSubsystemMessage.ComponentStarted>(Subsystem);
            Subsystem.MasterMainBus.Unsubscribe <ProjectionSubsystemMessage.ComponentStopped>(Subsystem);

            Subsystem.MasterMainBus.Subscribe(new AdHocHandler <Message>(
                                                  msg => {
                switch (msg)
                {
                case ProjectionSubsystemMessage.StartComponents start: {
                    _lastStartMessage = start;
                    _startReceived.Set();
                    break;
                }

                case ProjectionSubsystemMessage.StopComponents stop: {
                    _lastStopMessage = stop;
                    _stopReceived.Set();
                    break;
                }
                }
            }));

            Subsystem.Start();

            Given();
        }
 protected void ResetMessageEvents()
 {
     _stopReceived.Reset();
     _startReceived.Reset();
     _lastStopMessage  = null;
     _lastStartMessage = null;
 }
 public void Handle(ProjectionSubsystemMessage.StartComponents message)
 {
     if (_currentState != CoreCoordinatorState.Stopped)
     {
         Log.Debug("PROJECTIONS: Projection Core Coordinator cannot start components as it's not stopped. Correlation: {correlation}",
                   message.InstanceCorrelationId);
         return;
     }
     _instanceCorrelationId = message.InstanceCorrelationId;
     Log.Debug("PROJECTIONS: Projection Core Coordinator component starting. Correlation: {correlation}",
               _instanceCorrelationId);
     Start();
 }