public async Task should_be_able_to_Create_a_key_without_applications_mapped()
        {
            var cmd = new CreateApiKey("Mofo", Guid.NewGuid().ToString("N"), Guid.NewGuid().ToString("N"));

            var sut = new CreateApiKeyHandler(_uow);
            await sut.ExecuteAsync(cmd);

            var repos     = new ApiKeyRepository(_uow);
            var generated = await repos.GetByKeyAsync(cmd.ApiKey);

            generated.Should().NotBeNull();
            generated.AllowedApplications.Should().BeEmpty();
        }
        public async Task Should_be_able_to_Create_a_key_without_applications_mapped()
        {
            var cmd = new CreateApiKey("Mofo", Guid.NewGuid().ToString("N"), Guid.NewGuid().ToString("N"));
            var bus = Substitute.For <IEventBus>();

            var sut = new CreateApiKeyHandler(_uow, bus);
            await sut.ExecuteAsync(cmd);

            var repos     = new ApiKeyRepository(_uow);
            var generated = await repos.GetByKeyAsync(cmd.ApiKey);

            generated.Should().NotBeNull();
            generated.Claims.Should().NotBeEmpty("because keys without appIds are universal");
        }
        public async Task Should_be_able_to_Create_key()
        {
            var cmd = new CreateApiKey("Mofo", Guid.NewGuid().ToString("N"), Guid.NewGuid().ToString("N"),
                                       new[] { _applicationId });
            var bus = Substitute.For <IEventBus>();

            var sut = new CreateApiKeyHandler(_uow, bus);
            await sut.ExecuteAsync(cmd);

            var repos     = new ApiKeyRepository(_uow);
            var generated = await repos.GetByKeyAsync(cmd.ApiKey);

            generated.Should().NotBeNull();
            generated.Claims.First().Value.Should().BeEquivalentTo(_applicationId.ToString());
        }