コード例 #1
0
        public void ShouldUpdateApplication()
        {
            var appId      = "ffffffff-ffff-ffff-ffff-ffffffffffff";
            var appRequest = new AppRequest
            {
                Id   = "ffffffff-ffff-ffff-ffff-ffffffffffff",
                Name = "UpdatedAppTest"
            };

            // TODO: don't want to introduce UrlEncode dependency, but URLs are hardcoded
            SetExpect($"{ApiUrl}/v2/applications/{appId}",
                      "{  \"id\": \"ffffffff-ffff-ffff-ffff-ffffffffffff\",  \"name\": \"UpdatedAppTest\", \"capabilities\": {\"voice\": {\"webhooks\": {\"answer_url\": {\"address\": \"https://example.com/webhooks/answer\",\"http_method\": \"POST\"},\"fallback_answer_url\": {\"address\": \"https://fallback.example.com/webhooks/answer\",\"http_method\": \"POST\"},\"event_url\": {\"address\": \"https://example.com/webhooks/event\",\"http_method\": \"POST\"}}},\"messages\": {\"webhooks\": {\"inbound_url\": {\"address\": \"https://example.com/webhooks/inbound\",\"http_method\": \"POST\"},\"status_url\": {\"address\": \"https://example.com/webhooks/status\",\"http_method\": \"POST\"}}},\"rtc\": {\"webhooks\": {\"event_url\": {\"address\": \"https://example.com/webhooks/event\",\"http_method\": \"POST\"}}},\"vbc\": {}}}");

            var result = ApplicationV2.Update(appRequest);

            Assert.AreEqual("UpdatedAppTest", result.Name);
        }