public async Task Handle_Will_CreateChannel_AND_EnsureUserGroupExists_AND_SendNotificationToChannel()
        {
            // Arrange
            var slackFacadeSpy           = new SlackFacadeSpy();
            var stubCapabilityRepository = new StubCapabilityRepository();

            var slackService    = new SlackService(slackFacadeSpy, null);
            var slackServiceSpy = new SlackServiceSpy(slackService);
            var nullLogger      = new  Microsoft.Extensions.Logging.Abstractions.NullLogger <SlackCapabilityCreatedDomainEventHandler>();

            var handler = new SlackCapabilityCreatedDomainEventHandler(
                logger: nullLogger,
                slackFacadeSpy,
                stubCapabilityRepository,
                slackServiceSpy
                );


            var capabilityCreatedDomainEvent = CapabilityCreatedDomainEvent.Create(
                Guid.NewGuid(),
                "aFineCapability"
                );


            // Act
            await handler.HandleAsync(capabilityCreatedDomainEvent);

            // Assert
            Assert.NotNull(slackFacadeSpy.CreatedChannelName);
            Assert.True(slackServiceSpy.EnsureUserGroupExistsHasBeenCalled);
            Assert.NotEmpty(slackFacadeSpy.ChannelsMessages);
            Assert.NotEmpty(slackFacadeSpy.ChannelsPinnedMessageTimeStamps);
        }
Beispiel #2
0
        private async Task And_a_existing_capability_slack_channel()
        {
            _capabilityId   = Guid.NewGuid();
            _capabilityName = "aFineCapability";
            var capabilityCreatedDomainEvent = CapabilityCreatedDomainEvent.Create(
                _capabilityId,
                _capabilityName
                );
            var handler = _serviceProvider.GetService <IEventHandler <CapabilityCreatedDomainEvent> >();

            // Act
            await handler.HandleAsync(capabilityCreatedDomainEvent);
        }