public async Task SaveEvents_does_not_commit_for_empty_events()
        {
            var context = new DbContextSpy(_dbContextOptions);
            var sut     = new SqlEventStore(
                () => context,
                new JsonMessageSerializer());

            await sut.SaveEvents <FakeUser>(Enumerable.Empty <IDomainEvent>());

            context.CommitCount.Should().Be(0);
        }
        public async Task SaveEvents_commits_once()
        {
            var userId = Guid.NewGuid();
            var events = new DomainEvent[]
            {
                new FakeUserCreated(),
                new FakeUsernameChanged(),
            };

            events.Raise(userId);
            var context = new DbContextSpy(_dbContextOptions);
            var sut     = new SqlEventStore(
                () => context,
                new JsonMessageSerializer());

            await sut.SaveEvents <FakeUser>(events);

            context.CommitCount.Should().Be(1);
        }