public void WebhookSubscription_Serialization()
        {
            var subscription = new WebhookSubscription("https://google.com");

            Assert.AreEqual(@"{""endpoint"":""https://google.com""}", subscription.ToJson());
            subscription.Dirty = false;
            Assert.AreEqual(@"{""endpoint"":""https://google.com""}", subscription.ToJson());
            subscription.ClientId = "1234567890";
            subscription.Events   = new StringEnumValue <WebhookResourceEvent>[] { "add", "update", "remove" };
            Assert.AreEqual(@"{""endpoint"":""https://google.com"",""clientId"":""1234567890"",""events"":[""add"",""update"",""remove""]}", subscription.ToJson());
            subscription.Dirty = false;
            Assert.AreEqual(@"{""endpoint"":""https://google.com""}", subscription.ToJson());
        }
Exemple #2
0
        public void WebhookSubscription_Serialization()
        {
            var subscription = new WebhookSubscription("https://google.com", WebhookResourceType.Loan, new[] { WebhookResourceEvent.Create, WebhookResourceEvent.Update })
            {
                ClientId = "1234567890"
            };

            Assert.AreEqual(@"{""events"":[""create"",""update""],""endpoint"":""https://google.com"",""resource"":""Loan""}", subscription.ToJson());
        }