public void Create()
{
var responseJson = GetJsonPayload("/webhooks/webhooksApi/response/createWebhook.json");
var requestJson = GetJsonPayload("/webhooks/webhooksApi/request/createWebhook.json");
var restRequest = MockRestResponse(responseJson);
var webhook = new Webhook
{
Name = "API hook",
Resource = ResourceType.TEXT_BROADCAST,
Events = new HashSet<ResourceEvent> { ResourceEvent.STARTED, ResourceEvent.STOPPED },
Callback = "http://yoursite.com/webhook"
};
var id = Client.WebhooksApi.Create(webhook);
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));
}