protected override void Given()
 {
     _ioDispatcher = new IODispatcher(_node.Node.MainQueue, new PublishEnvelope(_node.Node.MainQueue));
     _node.Node.MainBus.Subscribe(_ioDispatcher.BackwardReader);
     _node.Node.MainBus.Subscribe(_ioDispatcher.ForwardReader);
     _node.Node.MainBus.Subscribe(_ioDispatcher.Writer);
     _node.Node.MainBus.Subscribe(_ioDispatcher.StreamDeleter);
     _node.Node.MainBus.Subscribe(_ioDispatcher.Awaker);
     _node.Node.MainBus.Subscribe(_ioDispatcher);
     _projectionNamesBuilder = ProjectionNamesBuilder.CreateForTest(_projectionName);
     _emittedStreamsTracker = new EmittedStreamsTracker(_ioDispatcher, new ProjectionConfig(null, 1000, 1000 * 1000, 100, 500, true, true, false, false, false, _trackEmittedStreams), _projectionNamesBuilder);
     _emittedStreamsDeleter = new EmittedStreamsDeleter(_ioDispatcher, _projectionNamesBuilder.GetEmittedStreamsName(), _projectionNamesBuilder.GetEmittedStreamsCheckpointName());
 }
 public void DeleteProjectionStreams()
 {
     var sourceDefinition = PersistedProjectionState.SourceDefinition ?? new ProjectionSourceDefinition();
     var projectionNamesBuilder = new ProjectionNamesBuilder(_name, sourceDefinition);
     if (PersistedProjectionState.DeleteCheckpointStream)
     {
         DeleteStream(projectionNamesBuilder.MakeCheckpointStreamName(), DeleteIfConditionsAreMet);
     }
     if (PersistedProjectionState.DeleteEmittedStreams)
     {
         if (_emittedStreamsDeleter == null)
         {
             _emittedStreamsDeleter = new EmittedStreamsDeleter(
                 _ioDispatcher, 
                 projectionNamesBuilder.GetEmittedStreamsName(), 
                 projectionNamesBuilder.GetEmittedStreamsCheckpointName());
         }
         _emittedStreamsDeleter.DeleteEmittedStreams(DeleteIfConditionsAreMet);
     }
     if(!PersistedProjectionState.DeleteCheckpointStream &&
        !PersistedProjectionState.DeleteEmittedStreams)
     {
         DeleteIfConditionsAreMet();
     }
 }