Exemple #1
0
        public async Task ShouldDeliverCorrectEvent()
        {
            // Arrange
            var evt = new TestEvent(Guid.NewGuid(), "Test Property");
            await _sut.StartAsync(CancellationToken.None).ConfigureAwait(false);

            // Act
            await _streamStore.AppendToStream(Guid.NewGuid().ToString(), ExpectedVersion.NoStream, new[]
            {
                evt.ToMessageData()
            }, CancellationToken.None);

            // Give the subscription event time to fire
            _waitEvent.Wait();

            // Assert
            var observedEvent = _observedEvent as TestEvent;

            observedEvent.ShouldNotBeNull();
            observedEvent.Id.ShouldBe(evt.Id);
            observedEvent.Property.ShouldBe(evt.Property);
        }