public async Task Events_saved_to_the_in_memory_context_have_their_id_set()
        {
            var eventStream = new InMemoryEventStream();

            using (var db = new InMemoryEventStoreDbContext(eventStream))
            {
                Events.Write(5, createEventStore: () => db);

                await db.SaveChangesAsync();

                Console.WriteLine(db.Events.Count());
            }

            using (var db = new InMemoryEventStoreDbContext(eventStream))
            {
                db.Events
                .Select(e => e.Id)
                .Should()
                .BeEquivalentTo(1L, 2L, 3L, 4L, 5L);
            }
        }
        public async Task Events_can_be_added_to_the_context_and_queried_back()
        {
            var aggregateId = Any.Guid();

            var storableEvent = new Order.Created
            {
                CustomerName = Any.FullName(),
                AggregateId = aggregateId
            }.ToStorableEvent();

            var eventStream = new InMemoryEventStream();

            using (var db = new InMemoryEventStoreDbContext(eventStream))
            {
                db.Events.Add(storableEvent);

                await db.SaveChangesAsync();

                var orderCreated = db.Events.Single(e => e.AggregateId == aggregateId);

                orderCreated.Should().NotBeNull();
            }
        }
        public async Task Events_can_be_added_to_the_context_and_queried_back()
        {
            var aggregateId = Any.Guid();

            var storableEvent = new Order.Created
            {
                CustomerName = Any.FullName(),
                AggregateId  = aggregateId
            }.ToStorableEvent();

            var eventStream = new InMemoryEventStream();

            using (var db = new InMemoryEventStoreDbContext(eventStream))
            {
                db.Events.Add(storableEvent);

                await db.SaveChangesAsync();

                var orderCreated = db.Events.Single(e => e.AggregateId == aggregateId);

                orderCreated.Should().NotBeNull();
            }
        }
        public async Task Events_saved_to_the_in_memory_context_have_their_id_set()
        {
            var eventStream = new InMemoryEventStream();

            using (var db = new InMemoryEventStoreDbContext(eventStream))
            {
                Events.Write(5, createEventStore: () => db);

                await db.SaveChangesAsync();

                Console.WriteLine(db.Events.Count());
            }

            using (var db = new InMemoryEventStoreDbContext(eventStream))
            {
                Console.WriteLine(db.Events.Count());

                db.Events
                  .Select(e => e.Id)
                  .Should()
                  .BeEquivalentTo(1L, 2L, 3L, 4L, 5L);
            }
        }