protected override IEnumerable <WhenStep> When() { ProjectionManagementMessage.Command.Post message = new ProjectionManagementMessage.Command.Post( Envelope, ProjectionMode.Transient, _projectionName, ProjectionManagementMessage.RunAs.System, typeof(FakeForeachStreamProjection), "", true, false, false, false); _mp.InitializeNew( new ManagedProjection.PersistedState { Enabled = message.Enabled, HandlerType = message.HandlerType, Query = message.Query, Mode = message.Mode, EmitEnabled = message.EmitEnabled, CheckpointsDisabled = !message.CheckpointsEnabled, Epoch = -1, Version = -1, RunAs = message.EnableRunAs ? SerializedRunAs.SerializePrincipal(message.RunAs) : null, }, null); var sourceDefinition = new FakeForeachStreamProjection("", Console.WriteLine).GetSourceDefinition(); var projectionSourceDefinition = ProjectionSourceDefinition.From(sourceDefinition); _mp.Handle( new CoreProjectionStatusMessage.Prepared( _coreProjectionId, projectionSourceDefinition)); yield break; }
protected override IEnumerable <WhenStep> When() { ProjectionManagementMessage.Command.Post message = new ProjectionManagementMessage.Command.Post( Envelope, ProjectionMode.OneTime, _projectionName, ProjectionManagementMessage.RunAs.System, typeof(FakeForeachStreamProjection), "", true, false, false, false); _managedProjection.InitializeNew( new ManagedProjection.PersistedState { Enabled = message.Enabled, HandlerType = message.HandlerType, Query = message.Query, Mode = message.Mode, EmitEnabled = message.EmitEnabled, CheckpointsDisabled = !message.CheckpointsEnabled, Epoch = -1, Version = -1, RunAs = message.EnableRunAs ? SerializedRunAs.SerializePrincipal(message.RunAs) : null, }, null); var sourceDefinition = new FakeForeachStreamProjection("", Console.WriteLine).GetSourceDefinition(); var projectionSourceDefinition = ProjectionSourceDefinition.From(sourceDefinition); _managedProjection.Handle( new CoreProjectionStatusMessage.Prepared( _coreProjectionId, projectionSourceDefinition)); _originalPersistedStateEventId = _consumer.HandledMessages.OfType <ClientMessage.WriteEvents>() .Where(x => x.EventStreamId == _projectionDefinitionStreamId).First().Events[0].EventId; CompleteWriteWithResult(_failureCondition); _consumer.HandledMessages.Clear(); yield break; }
protected override IEnumerable<WhenStep> When() { ProjectionManagementMessage.Post message = new ProjectionManagementMessage.Post( Envelope, ProjectionMode.Transient, _projectionName, ProjectionManagementMessage.RunAs.System, typeof(FakeForeachStreamProjection), "", true, false, false); _mp.InitializeNew(() => { }, new ManagedProjection.PersistedState { Enabled = message.Enabled, HandlerType = message.HandlerType, Query = message.Query, Mode = message.Mode, EmitEnabled = message.EmitEnabled, CheckpointsDisabled = !message.CheckpointsEnabled, Epoch = -1, Version = -1, RunAs = message.EnableRunAs ? ManagedProjection.SerializePrincipal(message.RunAs) : null, }); var sourceDefinition = new FakeForeachStreamProjection("", Console.WriteLine).GetSourceDefinition(); var projectionSourceDefinition = ProjectionSourceDefinition.From( _projectionName, sourceDefinition, message.HandlerType, message.Query); _mp.Handle( new CoreProjectionManagementMessage.Prepared( _coreProjectionId, projectionSourceDefinition, null)); yield break; }