public void AddCustomGalleryTagsRequest_WithUrlNull_ThrowsArgumentNullException() { var requestBuilder = new CustomGalleryRequestBuilder(); var exception = Record.Exception(() => requestBuilder.AddCustomGalleryTagsRequest(null, new List<string>())); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); var argNullException = (ArgumentNullException) exception; Assert.Equal(argNullException.ParamName, "url"); }
public void AddFilteredOutGalleryTagRequest_WithTagNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var requestBuilder = new CustomGalleryRequestBuilder(); var mockUrl = $"{client.EndpointUrl}g/block_tag"; var exception = Record.Exception(() => requestBuilder.AddFilteredOutGalleryTagRequest(mockUrl, null)); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); var argNullException = (ArgumentNullException) exception; Assert.Equal(argNullException.ParamName, "tag"); }
public async Task AddFilteredOutGalleryTagRequest_Equal() { var client = new ImgurClient("123", "1234"); var requestBuilder = new CustomGalleryRequestBuilder(); var mockUrl = $"{client.EndpointUrl}g/block_tag"; var tag = "Cats"; var request = requestBuilder.AddFilteredOutGalleryTagRequest(mockUrl, tag); var expected = "tag=Cats"; Assert.NotNull(request); Assert.Equal(expected, await request.Content.ReadAsStringAsync().ConfigureAwait(false)); Assert.Equal("https://api.imgur.com/3/g/block_tag", request.RequestUri.ToString()); Assert.Equal(HttpMethod.Post, request.Method); }
public async Task AddCustomGalleryTagsRequest_Equal() { var client = new ImgurClient("123", "1234"); var requestBuilder = new CustomGalleryRequestBuilder(); var mockUrl = $"{client.EndpointUrl}g/custom/add_tags"; var tags = new List<string> {"Cats", "Dogs", "Seals"}; var request = requestBuilder.AddCustomGalleryTagsRequest(mockUrl, tags); var expected = "tags=Cats%2CDogs%2CSeals"; Assert.NotNull(request); Assert.Equal(expected, await request.Content.ReadAsStringAsync().ConfigureAwait(false)); Assert.Equal("https://api.imgur.com/3/g/custom/add_tags", request.RequestUri.ToString()); Assert.Equal(HttpMethod.Put, request.Method); }
public void RemoveFilteredOutGalleryTagRequest_WithUrlNull_ThrowsArgumentNullException() { var requestBuilder = new CustomGalleryRequestBuilder(); var exception = Record.Exception(() => requestBuilder.RemoveFilteredOutGalleryTagRequest(null, "test")); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); var argNullException = (ArgumentNullException) exception; Assert.Equal(argNullException.ParamName, "url"); }
public void RemoveFilteredOutGalleryTagRequest_Equal() { var client = new ImgurClient("123", "1234"); var requestBuilder = new CustomGalleryRequestBuilder(); var mockUrl = $"{client.EndpointUrl}g/unblock_tag"; var tag = "Cats"; var request = requestBuilder.RemoveFilteredOutGalleryTagRequest(mockUrl, tag); var expected = "https://api.imgur.com/3/g/unblock_tag"; Assert.NotNull(request); Assert.Equal(expected, request.RequestUri.ToString()); Assert.Equal(HttpMethod.Post, request.Method); }
public void RemoveCustomGalleryTagsRequest_Equal() { var client = new ImgurClient("123", "1234"); var requestBuilder = new CustomGalleryRequestBuilder(); var mockUrl = $"{client.EndpointUrl}g/custom/remove_tags"; var tags = new List<string> {"Cats", "Dogs", "Seals"}; var request = requestBuilder.RemoveCustomGalleryTagsRequest(mockUrl, tags); var expected = "https://api.imgur.com/3/g/custom/remove_tags?tags=Cats%2CDogs%2CSeals"; Assert.NotNull(request); Assert.Equal(expected, request.RequestUri.ToString()); Assert.Equal(HttpMethod.Delete, request.Method); }