private PublishToGalleryRequest ( string url, string title, string topicId = null, bool bypassTerms = null, bool mature = null ) : |
||
url | string | |
title | string | |
topicId | string | |
bypassTerms | bool | |
mature | bool | |
return |
public void PublishToGalleryRequest_WithUrlNull_ThrowsArgumentNullException() { var requestBuilder = new GalleryRequestBuilder(); var exception = Record.Exception(() => requestBuilder.PublishToGalleryRequest(null, "test")); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); var argNullException = (ArgumentNullException) exception; Assert.Equal(argNullException.ParamName, "url"); }
public async Task PublishToGalleryRequest_WithTitleOnly_Equal() { var client = new ImgurClient("123", "1234"); var requestBuilder = new GalleryRequestBuilder(); var mockUrl = $"{client.EndpointUrl}gallery/XysioD"; var request = requestBuilder.PublishToGalleryRequest(mockUrl, "Hello World!"); Assert.NotNull(request); var expected = "title=Hello+World%21"; Assert.Equal(expected, await request.Content.ReadAsStringAsync().ConfigureAwait(false)); Assert.Equal("https://api.imgur.com/3/gallery/XysioD", request.RequestUri.ToString()); Assert.Equal(HttpMethod.Post, request.Method); }