public void Then_DoesNotThrowWhenEventsAreTheSameAsStorage()
        {
            var events        = new IDomainEvent[] { new FakeDomainEvent() };
            var untypedEvents = events.Select(e =>
                                              new UntypedEventEnvelope(Guid.NewGuid()
                                                                       , new UntypedEventEnvelope.EventMetadata(Guid.NewGuid().ToString()
                                                                                                                , Guid.NewGuid().ToString())
                                                                       , e)
                                              ).ToArray();

            _storage.AppendEvents("", 0, untypedEvents);

            _sut.Then(events);
        }
        public void Given(params IDomainEvent[] events)
        {
            _givenEvents.AddRange(events);
            var newEvents = events.Select(e =>
                                          new UntypedEventEnvelope(
                                              Guid.NewGuid(),
                                              new UntypedEventEnvelope.EventMetadata(
                                                  Guid.NewGuid().ToString()
                                                  , Guid.NewGuid().ToString()),
                                              e
                                              )).ToArray();

            _eventStorage.AppendEvents(streamName
                                       , 0
                                       , newEvents);
        }
 // static string GetStreamName(AggregateState<TState> state)
 // => state.GetType() + state.Id
 public Task Save(UnitOfWork <TState> unitOfWork, long version)
 {
     return(_store.AppendEvents(unitOfWork.State.StreamName
                                , version
                                , unitOfWork.Changes));
 }