コード例 #1
0
        public async Task Should_Send_Webhook_To_Tenant_If_All_Required_Features_Granted_Async()
        {
            //user_deleted webhook requires AppFeatures.WebhookFeature, AppFeatures.TestFeature but not requires all
            var(subscription, data, predicate) = InitializeTestCase(
                AppWebhookDefinitionNames.Users.Deleted,
                new Dictionary <string, string>
            {
                { AppFeatures.WebhookFeature, "true" }
            }
                );

            await _webhookPublisher.PublishAsync(AppWebhookDefinitionNames.Users.Deleted, data, subscription.TenantId);

            await _backgroundJobManagerSubstitute.Received()
            .EnqueueAsync <WebhookSenderJob, WebhookSenderArgs>(Arg.Is <WebhookSenderArgs>(w => predicate(w)));

            _backgroundJobManagerSubstitute.ClearReceivedCalls();

            //DefaultThemeChanged webhook requires AppFeatures.WebhookFeature, AppFeatures.ThemeFeature and requires all
            var(subscription2, data2, predicate2) = InitializeTestCase(
                AppWebhookDefinitionNames.Theme.DefaultThemeChanged,
                new Dictionary <string, string>
            {
                { AppFeatures.WebhookFeature, "true" },
                { AppFeatures.ThemeFeature, "true" }
            });

            await _webhookPublisher.PublishAsync(AppWebhookDefinitionNames.Theme.DefaultThemeChanged, data2,
                                                 subscription2.TenantId);

            await _backgroundJobManagerSubstitute.Received()
            .EnqueueAsync <WebhookSenderJob, WebhookSenderArgs>(Arg.Is <WebhookSenderArgs>(w => predicate2(w)));
        }