示例#1
0
            protected override IEnumerable <WhenStep> When()
            {
                yield return(CreateWriteEvent("stream1", "type1", "{\"Data\": 1}"));

                yield return
                    (new ProjectionManagementMessage.Command.Post(
                         Envelope, ProjectionMode.Continuous, _projectionName,
                         ProjectionManagementMessage.RunAs.System, "js", GivenOriginalSource(), true,
                         _checkpointsEnabled, _emitEnabled, _trackEmittedStreams));

                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.Command.Disable(
                         Envelope, _projectionName, ProjectionManagementMessage.RunAs.System));

                yield return
                    (new ProjectionManagementMessage.Command.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.Command.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.Command.GetStatistics(
                         Envelope, ProjectionMode.AllNonTransient, _projectionName, false));

                yield return(new ProjectionManagementMessage.Command.GetState(Envelope, _projectionName, ""));

                yield return
                    (new ProjectionManagementMessage.Command.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();
            }
 private string QueryFormatter(ICodec codec, ProjectionManagementMessage.ProjectionQuery state)
 {
     return(state.Query);
 }
 private ResponseConfiguration QueryConfigurator(ICodec codec, ProjectionManagementMessage.ProjectionQuery state)
 {
     return(_jsOkConfiguration);
 }
示例#4
0
 private ResponseConfiguration QueryConfigurator(ICodec codec, ProjectionManagementMessage.ProjectionQuery state)
 {
     return(Configure.OkNoCache("application/javascript"));
 }
示例#5
0
 private ResponseConfiguration QueryConfigConfigurator(ICodec codec,
                                                       ProjectionManagementMessage.ProjectionQuery state)
 {
     return(Configure.Ok("application/json", Helper.UTF8NoBom, null, null, false));
 }
示例#6
0
 private string QueryConfigFormatter(ICodec codec, ProjectionManagementMessage.ProjectionQuery state)
 {
     return(state.ToJson());
 }
示例#7
0
 QueryConfigurator(ICodec codec, ProjectionManagementMessage.ProjectionQuery state)
 {
     return(Configure.Ok("application/javascript", Helper.UTF8NoBom, null, null, false));
 }