public void Create()
{
var responseJson = GetJsonPayload("/webhooks/subscriptionsApi/response/createSubscription.json");
var requestJson = GetJsonPayload("/webhooks/subscriptionsApi/request/createSubscription.json");
var restRequest = MockRestResponse(responseJson);
var subscription = new Subscription
{
Enabled = true,
Endpoint = "http://www.example.com/endpoint",
NotificationFormat = NotificationFormat.JSON,
BroadcastId = 14L,
TriggerEvent = TriggerEvent.CAMPAIGN_STARTED
};
var id = Client.SubscriptionsApi.Create(subscription);
Assert.That(Serializer.Serialize(id), Is.EqualTo(responseJson));
Assert.AreEqual(Method.POST, restRequest.Value.Method);
var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody);
Assert.That(requestBodyParam.Value, Is.EqualTo(requestJson));
}