public void Record()
        {
            // arrange
            var testEvent0 = new Event("session", "feedbackRegistered", "payload...\nmore...");
            var testEvent1 = new Event("conference", "sessionAdded", "foo bar foo bar");

            var sut            = new InMemoryEventStore();
            var recordedEvents = new List <IEvent>();

            sut.OnRecorded += recordedEvents.Add;

            // act
            sut.Record(testEvent0);
            sut.Record(testEvent1);

            // assert
            recordedEvents.Count.Should().Be(2);
            recordedEvents[0].ShouldBeEquivalentTo(testEvent0);
            recordedEvents[1].ShouldBeEquivalentTo(testEvent1);
        }
        public void Replay()
        {
            // arrange
            var testEvent0 = new Event("session", "feedbackRegistered", "payload...\nmore...");
            var testEvent1 = new Event("conference", "sessionAdded", "foo bar foo bar");
            var testEvent2 = new Event("session", "feedbackRegistered", "payload...\nmore...");

            var sut = new InMemoryEventStore();

            sut.Record(testEvent0);
            sut.Record(testEvent1);
            sut.Record(testEvent2);

            // act
            var result = sut.Replay().ToList();

            // assert
            result.Count().Should().Be(3);
            result[0].ShouldBeEquivalentTo(testEvent0, options => options.ExcludingMissingProperties());
            result[1].ShouldBeEquivalentTo(testEvent1, options => options.ExcludingMissingProperties());
        }
        public void QueryByContext()
        {
            // arrange
            const string context1   = "session";
            const string context2   = "conference";
            var          testEvent0 = new Event("foo context", "fooEvent", "payload...\nmore...");
            var          testEvent1 = new Event(context1, "sessionAdded", "foo bar foo bar");
            var          testEvent2 = new Event("bar context", "fooEvent2", "payload...\nmore...");
            var          testEvent3 = new Event(context2, "fooEvent3", "grade: green");
            var          sut        = new InMemoryEventStore();

            sut.Record(testEvent0);
            sut.Record(testEvent1);
            sut.Record(testEvent2);
            sut.Record(testEvent3);

            // act
            var result = sut.QueryByContext(context1, context2).ToList();

            // assert
            result.Count().Should().Be(2);
            result[0].ShouldBeEquivalentTo(testEvent1, options => options.ExcludingMissingProperties());
            result[1].ShouldBeEquivalentTo(testEvent3, options => options.ExcludingMissingProperties());
        }