private void When()
 {
     try {
         _it.Handle(
             new AwakeServiceMessage.SubscribeAwake(
                 _envelope, Guid.NewGuid(), "Stream", new TFPos(1000, 500), _reply1));
         _it.Handle(
             new AwakeServiceMessage.SubscribeAwake(
                 _envelope, Guid.NewGuid(), "Stream2", new TFPos(1000, 500), _reply2));
         _it.Handle(
             new AwakeServiceMessage.SubscribeAwake(
                 _envelope, Guid.NewGuid(), null, new TFPos(1000, 500), _reply3));
     } catch (Exception ex) {
         _exception = ex;
     }
 }
Example #2
0
 private void When()
 {
     try {
         _it.Handle(_eventCommitted);
     } catch (Exception ex) {
         _exception = ex;
     }
 }
Example #3
0
        private void Given()
        {
            _it = new Core.Services.AwakeReaderService.AwakeService();

            var recordFactory = LogFormatHelper <TLogFormat, TStreamId> .RecordFactory;
            var streamId      = LogFormatHelper <TLogFormat, TStreamId> .StreamId;
            var eventTypeId   = LogFormatHelper <TLogFormat, TStreamId> .EventTypeId;

            _eventRecord = new EventRecord(
                100,
                LogRecord.Prepare(
                    recordFactory, 1500, Guid.NewGuid(), Guid.NewGuid(), 1500, 0, streamId, 99, PrepareFlags.Data,
                    eventTypeId, new byte[0], null, DateTime.UtcNow), "Stream", "EventType");
            _eventCommitted = new StorageMessage.EventCommitted(2000, _eventRecord, isTfEof: true);
            _publisher      = new InMemoryBus("bus");
            _envelope       = new PublishEnvelope(_publisher);
            _handler        = new TestHandler <TestMessage>();
            _publisher.Subscribe(_handler);
            _reply1 = new TestMessage(1);
            _reply2 = new TestMessage(2);
            _reply3 = new TestMessage(3);
            _reply4 = new TestMessage(4);
            _reply5 = new TestMessage(5);

            _correlationId1 = Guid.NewGuid();
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, _correlationId1, "Stream", new TFPos(1000, 500), _reply1));
            _correlationId2 = Guid.NewGuid();
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, _correlationId2, "Stream", new TFPos(100000, 99500), _reply2));
            _correlationId3 = Guid.NewGuid();
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, _correlationId3, "Stream2", new TFPos(1000, 500), _reply3));
            _correlationId4 = Guid.NewGuid();
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, _correlationId4, null, new TFPos(1000, 500), _reply4));
            _correlationId5 = Guid.NewGuid();
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, _correlationId5, null, new TFPos(100000, 99500), _reply5));
        }
 private void When()
 {
     try {
         _it.Handle(
             new AwakeServiceMessage.SubscribeAwake(
                 _envelope, Guid.NewGuid(), "Stream", new TFPos(1000, 500), new Bus.Helpers.TestMessage()));
     } catch (Exception ex) {
         _exception = ex;
     }
 }
        private void Given()
        {
            _it = new Core.Services.AwakeReaderService.AwakeService();

            var logFormat = LogFormatHelper <TLogFormat, TStreamId> .LogFormat;

            logFormat.StreamNameIndex.GetOrAddId("Stream", out var streamId, out _, out _);

            _eventRecord = new EventRecord(
                100,
                LogRecord.Prepare(
                    logFormat.RecordFactory, 1500, Guid.NewGuid(), Guid.NewGuid(), 1500, 0, streamId, 99, PrepareFlags.Data,
                    "event", new byte[0], null, DateTime.UtcNow), "Stream");
            _eventCommitted = new StorageMessage.EventCommitted(2000, _eventRecord, isTfEof: true);
            _publisher      = new InMemoryBus("bus");
            _envelope       = new PublishEnvelope(_publisher);
            _handler        = new TestHandler <TestMessage>();
            _publisher.Subscribe(_handler);
            _reply1 = new TestMessage(1);
            _reply2 = new TestMessage(2);
            _reply3 = new TestMessage(3);
            _reply4 = new TestMessage(4);
            _reply5 = new TestMessage(5);

            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream", new TFPos(1000, 500), _reply1));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream", new TFPos(100000, 99500), _reply2));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream2", new TFPos(1000, 500), _reply3));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), null, new TFPos(1000, 500), _reply4));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), null, new TFPos(100000, 99500), _reply5));
        }
        private void Given()
        {
            _it = new Core.Services.AwakeReaderService.AwakeService();

            _eventRecord = new EventRecord(
                100,
                new PrepareLogRecord(
                    1500, Guid.NewGuid(), Guid.NewGuid(), 1500, 0, "Stream", 99, DateTime.UtcNow, PrepareFlags.Data,
                    "event", new byte[0], null));
            _eventCommitted = new StorageMessage.EventCommitted(2000, _eventRecord, isTfEof: true);
            _publisher      = new InMemoryBus("bus");
            _envelope       = new PublishEnvelope(_publisher);
            _handler        = new TestHandler <TestMessage>();
            _publisher.Subscribe(_handler);
            _reply1 = new TestMessage(1);
            _reply2 = new TestMessage(2);
            _reply3 = new TestMessage(3);
            _reply4 = new TestMessage(4);
            _reply5 = new TestMessage(5);

            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream", new TFPos(1000, 500), _reply1));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream", new TFPos(100000, 99500), _reply2));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream2", new TFPos(1000, 500), _reply3));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), null, new TFPos(1000, 500), _reply4));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), null, new TFPos(100000, 99500), _reply5));
        }
        private void Given()
        {
            _it = new Core.Services.AwakeReaderService.AwakeService();

            _eventRecord = new EventRecord(
                100,
                new PrepareLogRecord(
                    1500, Guid.NewGuid(), Guid.NewGuid(), 1500, 0, "Stream", 99, DateTime.UtcNow, PrepareFlags.Data,
                    "event", new byte[0], null));
            _eventCommitted = new StorageMessage.EventCommitted(2000, _eventRecord, isTfEof: true);
            _publisher = new InMemoryBus("bus");
            _envelope = new PublishEnvelope(_publisher);
            _handler = new TestHandler<TestMessage>();
            _publisher.Subscribe(_handler);
            _reply1 = new TestMessage(1);
            _reply2 = new TestMessage(2);
            _reply3 = new TestMessage(3);
            _reply4 = new TestMessage(4);
            _reply5 = new TestMessage(5);

            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream", new TFPos(1000, 500), _reply1));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream", new TFPos(100000, 99500), _reply2));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), "Stream2", new TFPos(1000, 500), _reply3));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), null, new TFPos(1000, 500), _reply4));
            _it.Handle(
                new AwakeServiceMessage.SubscribeAwake(
                    _envelope, Guid.NewGuid(), null, new TFPos(100000, 99500), _reply5));
        }
Example #8
0
 private void When()
 {
     try {
         _it.Handle(new AwakeServiceMessage.UnsubscribeAwake(_correlationId1));
         _it.Handle(new AwakeServiceMessage.UnsubscribeAwake(_correlationId2));
         _it.Handle(new AwakeServiceMessage.UnsubscribeAwake(_correlationId3));
         _it.Handle(new AwakeServiceMessage.UnsubscribeAwake(_correlationId4));
         _it.Handle(new AwakeServiceMessage.UnsubscribeAwake(_correlationId5));
         _it.Handle(_eventCommitted);
     } catch (Exception ex) {
         _exception = ex;
     }
 }
        private void Given()
        {
            _it = new Core.Services.AwakeReaderService.AwakeService();

            var recordFactory = LogFormatHelper <TLogFormat, TStreamId> .RecordFactory;
            var streamId      = LogFormatHelper <TLogFormat, TStreamId> .StreamId;

            _eventRecord = new EventRecord(
                100,
                LogRecord.Prepare(
                    recordFactory, 1500, Guid.NewGuid(), Guid.NewGuid(), 1500, 0, streamId, 99, PrepareFlags.Data,
                    "event", new byte[0], null, DateTime.UtcNow), "Stream");
            _eventCommitted = new StorageMessage.EventCommitted(2000, _eventRecord, isTfEof: true);
            _publisher      = new InMemoryBus("bus");
            _envelope       = new PublishEnvelope(_publisher);
            _handler        = new TestHandler <TestMessage>();
            _publisher.Subscribe(_handler);
            _reply1 = new TestMessage(1);
            _reply2 = new TestMessage(3);
            _reply3 = new TestMessage(4);

            _it.Handle(_eventCommitted);
        }