예제 #1
0
 private static bool Matchs(WebhookSchema webhookSchema, SchemaEvent @event)
 {
     return
         ((@event.SchemaId.Id == webhookSchema.SchemaId) &&
          (webhookSchema.SendCreate && @event is ContentCreated ||
           webhookSchema.SendUpdate && @event is ContentUpdated ||
           webhookSchema.SendDelete && @event is ContentDeleted ||
           webhookSchema.SendPublish && @event is ContentStatusChanged statusChanged && statusChanged.Status == Status.Published));
 }
예제 #2
0
 private static bool Matchs(WebhookSchema webhookSchema, SchemaEvent @event)
 {
     return
         ((@event.SchemaId.Id == webhookSchema.SchemaId) &&
          (@event is ContentCreated && webhookSchema.SendCreate ||
           @event is ContentUpdated && webhookSchema.SendUpdate ||
           @event is ContentDeleted && webhookSchema.SendDelete ||
           @event is ContentPublished && webhookSchema.SendPublish ||
           @event is ContentUnpublished && webhookSchema.SendUnpublish));
 }
예제 #3
0
        private IWebhookEntity CreateWebhook(int offset)
        {
            var webhook = A.Dummy <IWebhookEntity>();

            var schema = new WebhookSchema
            {
                SchemaId   = schemaId.Id,
                SendCreate = true,
                SendUpdate = true
            };

            A.CallTo(() => webhook.Id).Returns(Guid.NewGuid());
            A.CallTo(() => webhook.Url).Returns(new Uri($"http://domain{offset}.com"));
            A.CallTo(() => webhook.Schemas).Returns(new[] { schema });
            A.CallTo(() => webhook.SharedSecret).Returns($"secret{offset}");

            return(webhook);
        }