public void Should_create_envelope_data_from_event()
        {
            var @event = new EnrichedContentEvent {
                AppId = appId, Name = "MyEventName"
            };

            var result = sut.ToEnvelope(@event);

            Assert.Contains("MyEventName", result);
        }
Beispiel #2
0
        protected override (string Description, WebhookJob Data) CreateJob(EnrichedEvent @event, WebhookAction action)
        {
            var requestBody = formatter.ToEnvelope(@event).ToString(Formatting.Indented);
            var requestUrl  = formatter.Format(action.Url.ToString(), @event);

            var ruleDescription = $"Send event to webhook '{requestUrl}'";
            var ruleJob         = new WebhookJob
            {
                RequestUrl       = requestUrl,
                RequestSignature = $"{requestBody}{action.SharedSecret}".Sha256Base64(),
                RequestBodyV2    = requestBody
            };

            return(ruleDescription, ruleJob);
        }