protected bool Equals(ProjectionStatistics other)
 {
     return(string.Equals(Status, other.Status) && Enabled.Equals(other.Enabled) &&
            MasterStatus == other.MasterStatus &&
            string.Equals(StateReason, other.StateReason) &&
            string.Equals(Name, other.Name) &&
            ProjectionId == other.ProjectionId && Epoch == other.Epoch &&
            Version == other.Version && Mode == other.Mode &&
            Equals(Position, other.Position) &&
            Progress.Equals(other.Progress) &&
            string.Equals(LastCheckpoint, other.LastCheckpoint) &&
            EventsProcessedAfterRestart ==
            other.EventsProcessedAfterRestart &&
            BufferedEvents == other.BufferedEvents &&
            string.Equals(CheckpointStatus, other.CheckpointStatus) &&
            WritePendingEventsBeforeCheckpoint ==
            other.WritePendingEventsBeforeCheckpoint &&
            WritePendingEventsAfterCheckpoint ==
            other.WritePendingEventsAfterCheckpoint &&
            PartitionsCached == other.PartitionsCached &&
            ReadsInProgress == other.ReadsInProgress &&
            WritesInProgress == other.WritesInProgress &&
            string.Equals(EffectiveName, other.EffectiveName) &&
            string.Equals(ResultStreamName, other.ResultStreamName) &&
            CoreProcessingTime == other.CoreProcessingTime);
 }
 protected override void Given()
 {
     _projectionId = Guid.NewGuid();
     _statistics = new ProjectionStatistics
     {
         BufferedEvents = 100,
         CheckpointStatus = "checkpoint-status",
         CoreProcessingTime = 10,
         ResultStreamName = "result-stream",
         EffectiveName = "effective-name",
         Enabled = true,
         Epoch = 10,
         EventsProcessedAfterRestart = 12345,
         LastCheckpoint = "last-chgeckpoint",
         MasterStatus = ManagedProjectionState.Completed,
         Mode = ProjectionMode.OneTime,
         PartitionsCached = 123,
         Name = "name",
         Position = CheckpointTag.FromPosition(0, 1000, 900).ToString(),
         Progress = 100,
         ProjectionId = 1234,
         ReadsInProgress = 2,
         StateReason = "reason",
         Status = "status",
         Version = 1,
         WritePendingEventsAfterCheckpoint = 3,
         WritePendingEventsBeforeCheckpoint = 4,
         WritesInProgress = 5,
         
         
     };
 }
 protected bool Equals(ProjectionStatistics other)
 {
     return string.Equals(Status, other.Status) && Enabled.Equals(other.Enabled)
            && MasterStatus == other.MasterStatus && string.Equals(StateReason, other.StateReason)
            && string.Equals(Name, other.Name) && ProjectionId == other.ProjectionId && Epoch == other.Epoch
            && Version == other.Version && Mode == other.Mode && Equals(Position, other.Position)
            && Progress.Equals(other.Progress) && string.Equals(LastCheckpoint, other.LastCheckpoint)
            && EventsProcessedAfterRestart == other.EventsProcessedAfterRestart
            && BufferedEvents == other.BufferedEvents && string.Equals(CheckpointStatus, other.CheckpointStatus)
            && WritePendingEventsBeforeCheckpoint == other.WritePendingEventsBeforeCheckpoint
            && WritePendingEventsAfterCheckpoint == other.WritePendingEventsAfterCheckpoint
            && PartitionsCached == other.PartitionsCached && ReadsInProgress == other.ReadsInProgress
            && WritesInProgress == other.WritesInProgress && string.Equals(EffectiveName, other.EffectiveName)
            && string.Equals(ResultStreamName, other.ResultStreamName) && CoreProcessingTime == other.CoreProcessingTime;
 }
            protected override IEnumerable<WhenStep> When()
            {
                yield return CreateWriteEvent("stream1", "type1", "{\"Data\": 1}");
                yield return
                    new ProjectionManagementMessage.Post(
                        Envelope, ProjectionMode.Continuous, _projectionName,
                        ProjectionManagementMessage.RunAs.System, "js", GivenOriginalSource(), true,
                        _checkpointsEnabled, _emitEnabled);
                yield return CreateWriteEvent("stream1", "type2", "{\"Data\": 2}");
                yield return CreateWriteEvent("stream2", "type2", "{\"Data\": 3}");
                yield return CreateWriteEvent("stream3", "type3", "{\"Data\": 4}");
                yield return CreateWriteEvent("stream3", "type1", "{\"Data\": 5}");
                yield return
                    new ProjectionManagementMessage.Disable(
                        Envelope, _projectionName, ProjectionManagementMessage.RunAs.System);
                yield return
                    new ProjectionManagementMessage.UpdateQuery(
                        Envelope, _projectionName, ProjectionManagementMessage.RunAs.System, "js",
                        GivenUpdatedSource(), _emitEnabled);
                yield return CreateWriteEvent("stream2", "type3", "{\"Data\": 6}");
                yield return CreateWriteEvent("stream3", "type4", "{\"Data\": 7}");
                yield return
                    new ProjectionManagementMessage.Enable(
                        Envelope, _projectionName, ProjectionManagementMessage.RunAs.System);
                yield return CreateWriteEvent("stream3", "type4", "{\"Data\": 8}");
                yield return CreateWriteEvent("stream4", "type5", "{\"Data\": 9}");
                yield return CreateWriteEvent("stream5", "type1", "{\"Data\": 10}");
                yield return
                    new ProjectionManagementMessage.GetStatistics(
                        Envelope, ProjectionMode.AllNonTransient, _projectionName, false);
                yield return new ProjectionManagementMessage.GetState(Envelope, _projectionName, "");
                yield return
                    new ProjectionManagementMessage.GetQuery(
                        Envelope, _projectionName, ProjectionManagementMessage.RunAs.Anonymous);

                _allStatistics = HandledMessages.OfType<ProjectionManagementMessage.Statistics>().LastOrDefault();
                _statistics = _allStatistics != null ? _allStatistics.Projections.SingleOrDefault() : null;

                _state = HandledMessages.OfType<ProjectionManagementMessage.ProjectionState>().LastOrDefault();
                _stateData = _state != null ? EatException(() => _state.State.ParseJson<JObject>()) : null;
                _query = HandledMessages.OfType<ProjectionManagementMessage.ProjectionQuery>().LastOrDefault();

            }
 public StatisticsReport(Guid projectionId, ProjectionStatistics statistics, int sequentialNumber)
     : base(projectionId)
 {
     _statistics = statistics;
     _sequentialNumber = sequentialNumber;
 }
 public Statistics(ProjectionStatistics[] projections)
 {
     _projections = projections;
 }
 public StatisticsReport(Guid projectionId, ProjectionStatistics statistics)
     : base(projectionId)
 {
     _statistics = statistics;
 }
 public override void EnrichStatistics(ProjectionStatistics info)
 {
 }
 public void GetStatistics(ProjectionStatistics info)
 {
 }
 public Statistics(ProjectionStatistics[] projections, long transactionFileHeadPosition)
 {
     _projections = projections;
     _transactionFileHeadPosition = transactionFileHeadPosition;
 }