Beispiel #1
0
        public async Task TestUpdateSnippetAsync()
        {
            Trace.WriteLine("PUT /snippets/(:id)");

            // Make the API call
            var uniqueName = String.Format("{0}-{1}", NEW_SNIPPET_NAME, SendwithusClientTest.RandomString(UNIQUE_ID_LENGTH));

            try
            {
                var snippetResponse = await Snippet.UpdateSnippetAsync(DEFAULT_SNIPPET_ID, uniqueName, NEW_SNIPPET_BODY);

                // Validate the response
                SendwithusClientTest.ValidateResponse(snippetResponse);
            }
            catch (AggregateException exception)
            {
                Assert.Fail(exception.ToString());
            }
        }
Beispiel #2
0
        public async Task TestDeleteSnippetAsync()
        {
            // Create a new Snippet so that it can be deleted
            var uniqueName      = String.Format("{0}-{1}", NEW_SNIPPET_NAME, SendwithusClientTest.RandomString(UNIQUE_ID_LENGTH));
            var snippetResponse = await Snippet.CreateSnippetAsync(uniqueName, NEW_SNIPPET_BODY);

            var snippetId = snippetResponse.snippet.id;

            // Make the API call
            Trace.WriteLine(String.Format("DELETE /snippets/{0}", snippetId));
            try
            {
                var genericApiCallStatus = await Snippet.DeleteSnippetAsync(snippetId);

                // Validate the response
                SendwithusClientTest.ValidateResponse(genericApiCallStatus);
            }
            catch (AggregateException exception)
            {
                Assert.Fail(exception.ToString());
            }
        }