public async Task GIVEN_query_with_ClientId_set_EXPECT_only_capabilities_with_given_id()
        {
            // Arrange
            var idOfWantedSender     = Guid.NewGuid();
            var capabilityRepository = new StubCapabilityRepository();
            await capabilityRepository.Add(Capability.Create(
                                               idOfWantedSender,
                                               "foo",
                                               "slackChannelId",
                                               "slackUserGroupId"
                                               ));

            await capabilityRepository.Add(Capability.Create(
                                               idOfWantedSender,
                                               "bar",
                                               "slackChannelId",
                                               "slackUserGroupId"
                                               ));

            await capabilityRepository.Add(Capability.Create(
                                               Guid.NewGuid(),
                                               "sheep",
                                               "slackChannelId",
                                               "slackUserGroupId"
                                               ));

            var slackFacadeSpy = new SlackFacadeSpy();

            var sut = new FindConnectionsByClientTypeClientIdChannelTypeChannelIdHandler(capabilityRepository, slackFacadeSpy);

            var clientIdOfWantedSender = new ClientId(idOfWantedSender.ToString());
            var query = new FindConnectionsByClientTypeClientIdChannelTypeChannelId(
                new ClientTypeCapability(),
                clientIdOfWantedSender,
                new ChannelTypeSlack(),
                null
                );


            // Act
            var results = await sut.HandleAsync(query);

            // Assert
            Assert.All(
                results,
                connection =>
                Assert.Equal(clientIdOfWantedSender, connection.ClientId)
                );
        }
        public async Task GIVEN_query_with_SenderType_not_equal_to_SenderTypeCapability_EXPECT_empty_result()
        {
            // Arrange
            var sut   = new FindConnectionsByClientTypeClientIdChannelTypeChannelIdHandler(null, null);
            var query = new FindConnectionsByClientTypeClientIdChannelTypeChannelId(
                new ClientTypeTest(),
                null,
                null,
                null
                );

            // Act
            var results = await sut.HandleAsync(query);


            // Assert
            Assert.Empty(results);
        }
        public async Task GIVEN_empty_query_EXPECT_connections_for_all_capabilities()
        {
            // Arrange
            var capabilityRepository = new StubCapabilityRepository();
            await capabilityRepository.Add(Capability.Create(
                                               Guid.NewGuid(),
                                               "foo",
                                               "slackChannelId",
                                               "slackUserGroupId"
                                               ));

            await capabilityRepository.Add(Capability.Create(
                                               Guid.NewGuid(),
                                               "bar",
                                               "slackChannelId",
                                               "slackUserGroupId"
                                               ));

            var slackFacadeSpy = new SlackFacadeSpy();

            slackFacadeSpy.Conversations.AddRange(new [] { new ChannelDto {
                                                               Id = "slackChannelId", Name = "slackChannelName"
                                                           } });
            var sut = new FindConnectionsByClientTypeClientIdChannelTypeChannelIdHandler(capabilityRepository, slackFacadeSpy);

            var query = new FindConnectionsByClientTypeClientIdChannelTypeChannelId(
                null,
                null,
                null,
                null
                );

            // Act
            var results = await sut.HandleAsync(query);

            Assert.All(
                capabilityRepository.GetAll().Result,
                capability =>
                results.Single(r =>
                               r.ClientId.ToString() == capability.Id.ToString()
                               )
                );
        }