public async Task VoteGalleryItemAsync_WithGalleryItemIdNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new GalleryEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.VoteGalleryItemAsync(null, VoteOption.Down).ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
        public async Task GetImageAsync_WithIdNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.GetGalleryImageAsync(null).ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
        public async Task CreateGalleryItemCommentAsync_WithCommentNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.CreateGalleryItemCommentAsync(null, "Xyz").ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
        public async Task GetSubredditImageAsync_NotNull()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/r/pics/xyP";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetSubredditImage)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var image = await endpoint.GetSubredditImageAsync("xyP", "pics").ConfigureAwait(false);

            Assert.NotNull(image);
        }
        public async Task GetGalleryItemTagsAsync_DefaultParameters_Any()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/xTYm/tags";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryItemTags)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var tags = await endpoint.GetGalleryItemTagsAsync("xTYm").ConfigureAwait(false);

            Assert.True(tags.Tags.Any());
        }
        public async Task VoteGalleryItemAsync_True()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/XoPkL/vote/down";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.VoteGalleryTag)
            };

            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var voted = await endpoint.VoteGalleryItemAsync("XoPkL", VoteOption.Down).ConfigureAwait(false);

            Assert.NotNull(voted);
        }
        public async Task GetGalleryAsync_DefaultParameters_Any()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/hot/viral/day/?showViral=true";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGallery)
            };

            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var gallery = await endpoint.GetGalleryAsync().ConfigureAwait(false);

            Assert.True(gallery.Any());
        }
        public async Task GetSubredditGalleryAsync_DefaultParameters_Any()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/r/pics/time/week/";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetSubredditGallery)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var gallery = await endpoint.GetSubredditGalleryAsync("pics").ConfigureAwait(false);

            Assert.True(gallery.Any());
        }
        public async Task GetRandomGalleryAsync_WithPage_Any()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/random/random/8";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetRandomGallery)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var gallery = await endpoint.GetRandomGalleryAsync(8).ConfigureAwait(false);

            Assert.True(gallery.Any());
        }
        public async Task CreateGalleryItemCommentAsync_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/dO484/comment";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.CreateGalleryItemComment)
            };

            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var comment = await endpoint.CreateGalleryItemCommentAsync("Hello World!", "dO484").ConfigureAwait(false);

            Assert.NotNull(comment);
            Assert.Equal(548357773, comment);
        }
        public async Task GetGalleryAsync_WithUserRisingMonth2ShowViralFalse_Any()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/user/rising/month/2?showViral=false";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGallery)
            };

            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var gallery = await endpoint.GetGalleryAsync(GallerySection.User,
                GallerySortOrder.Rising,
                TimeWindow.Month, 2, false).ConfigureAwait(false);

            Assert.True(gallery.Any());
        }
        public async Task GetGalleryItemVotesAsync_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/RoAjx/votes";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryItemVotes)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var votes = await endpoint.GetGalleryItemVotesAsync("RoAjx").ConfigureAwait(false);

            Assert.NotNull(votes);
            Assert.Equal(751, votes.Downs);
            Assert.Equal(11347, votes.Ups);
        }
        public async Task GetSubredditGalleryAsync_WithTopYearPage7_Any()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/r/pics/time/week/7";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetSubredditGallery)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var gallery =
                await
                    endpoint.GetSubredditGalleryAsync("pics", SubredditGallerySortOrder.Time, TimeWindow.Week, 7)
                        .ConfigureAwait(false);

            Assert.True(gallery.Any());
        }
        public async Task GetGalleryTagAsync_DefaultParameters_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/t/cats/viral/week/";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryTag)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var tag = await endpoint.GetGalleryTagAsync("cats").ConfigureAwait(false);

            Assert.NotNull(tag);
            Assert.Equal(196, tag.Followers);
            Assert.Equal(false, tag.Following);
            Assert.Equal(60, tag.Items.Count());
            Assert.Equal("cats", tag.Name);
            Assert.Equal(10920, tag.TotalItems);
        }
        public async Task GetImageAsync_NotNull()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/image/rNdMhHm";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryImage)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var image = await endpoint.GetGalleryImageAsync("rNdMhHm").ConfigureAwait(false);

            Assert.NotNull(image);
            Assert.Equal("rNdMhHm", image.Id);
            Assert.Equal("wanna make money quickly? follow the instruction below", image.Title);
            Assert.Equal("i am not lying. FP edit: may the money cat bless you all with wealth ^^", image.Description);
            Assert.Equal(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1451524552), image.DateTime);
            Assert.Equal("image/png", image.Type);
            Assert.Equal(false, image.Animated);
            Assert.Equal(610, image.Width);
            Assert.Equal(558, image.Height);
            Assert.Equal(564133, image.Size);
            Assert.Equal(923523, image.Views);
            Assert.Equal(520989800559, image.Bandwidth);
            Assert.Equal(null, image.Vote);
            Assert.Equal(false, image.Favorite);
            Assert.Equal(false, image.Nsfw);
            Assert.Equal("pics", image.Section);
            Assert.Equal("Calasin", image.AccountUrl);
            Assert.Equal(22349254, image.AccountId);
            Assert.Equal(619, image.CommentCount);
            Assert.Equal("No Topic", image.Topic);
            Assert.Equal(29, image.TopicId);
            Assert.Equal("http://i.imgur.com/rNdMhHm.png", image.Link);
            Assert.Equal(619, image.CommentCount);
            Assert.Equal(28057, image.Ups);
            Assert.Equal(5924, image.Downs);
            Assert.Equal(22133, image.Points);
            Assert.Equal(22594, image.Score);
            Assert.Null(image.Mp4Size);
        }
        public async Task GetAlbumAsync_NotNull()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/album/dO484";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryAlbum)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var album = await endpoint.GetGalleryAlbumAsync("dO484").ConfigureAwait(false);

            Assert.NotNull(album);
            Assert.Equal("dO484", album.Id);
            Assert.Equal("25 Films on Netflix I'd like to recommend.", album.Title);
            Assert.Equal(null, album.Description);
            Assert.Equal(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1451445880), album.DateTime);
            Assert.Equal("xUPbs5g", album.Cover);
            Assert.Equal(700, album.CoverWidth);
            Assert.Equal(394, album.CoverHeight);
            Assert.Equal("bellsofwar3", album.AccountUrl);
            Assert.Equal(28720941, album.AccountId);
            Assert.Equal(AlbumPrivacy.Public, album.Privacy);
            Assert.Equal(AlbumLayout.Blog, album.Layout);
            Assert.Equal(13972, album.Views);
            Assert.Equal("http://imgur.com/a/dO484", album.Link);
            Assert.Equal(2024, album.Ups);
            Assert.Equal(28, album.Downs);
            Assert.Equal(1996, album.Points);
            Assert.Equal(1994, album.Score);
            Assert.Equal(null, album.Vote);
            Assert.Equal(false, album.Favorite);
            Assert.Equal(false, album.Nsfw);
            Assert.Equal("", album.Section);
            Assert.Equal(79, album.CommentCount);
            Assert.Equal("The More You Know", album.Topic);
            Assert.Equal(11, album.TopicId);
            Assert.Equal(25, album.ImagesCount);
            Assert.Equal(25, album.Images.Count());
        }
        public async Task GetGalleryItemCommentsAsync_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/Mxd8cg0/comments/oldest";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryItemComments)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var comments =
                await endpoint.GetGalleryItemCommentsAsync("Mxd8cg0", CommentSortOrder.Oldest).ConfigureAwait(false);

            Assert.Equal(12, comments.Count());
        }
        public async Task SearchGalleryAdvancedAsync_True()
        {
            var mockUrl =
                "https://api.imgur.com/3/gallery/search/top/week/2?q_all=star+wars&q_any=luke+han+leia&q_exactly=Obi-Wan&q_not=Kirk&q_type=anigif&q_size_px=lrg";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.SearchGalleryAdvanced)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var galleries =
                await
                    endpoint.SearchGalleryAdvancedAsync("star wars", "luke han leia", "Obi-Wan", "Kirk",
                        ImageFileType.Anigif, ImageSize.Lrg, GallerySortOrder.Top, TimeWindow.Week, 2)
                        .ConfigureAwait(false);

            Assert.True(galleries.Any());
        }
        public async Task GetGalleryItemCommentAsync_NotNull()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/Mxd8cg0/comment/548357773";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryItemComment)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var comment = await endpoint.GetGalleryItemCommentAsync(548357773, "Mxd8cg0").ConfigureAwait(false);

            Assert.NotNull(comment);
            Assert.Equal(548357773, comment.Id);
            Assert.Equal("Mxd8cg0", comment.ImageId);
            Assert.Equal("Would be nice to be in my 20s again and not have to favorite this :/", comment.CommentText);
            Assert.Equal("imgurapidotnet", comment.Author);
            Assert.Equal(24562464, comment.AuthorId);
            Assert.Equal(null, comment.AlbumCover);
            Assert.Equal(1, comment.Ups);
            Assert.Equal(0, comment.Downs);
            Assert.Equal(1, comment.Points);
            Assert.Equal(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1451479114), comment.DateTime);
            Assert.Equal(0, comment.ParentId);
            Assert.Equal(false, comment.Deleted);
            Assert.Equal(VoteOption.Up, comment.Vote);
            Assert.Equal("api", comment.Platform);
            Assert.Equal(0, comment.Children.Count());
        }
        public async Task SearchGalleryAsync_True()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/search/top/week/2?q=star+wars";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.SearchGallery)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var galleries =
                await
                    endpoint.SearchGalleryAsync("star wars", GallerySortOrder.Top, TimeWindow.Week, 2)
                        .ConfigureAwait(false);

            Assert.True(galleries.Any());
        }
        public async Task PublishToGalleryAsync_True()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/xyZ";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.PublishToGallery)
            };

            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var published = await endpoint.PublishToGalleryAsync("xyZ", "Test Title").ConfigureAwait(false);

            Assert.True(published);
        }
        public async Task PublishToGalleryAsync_WithTopicNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () =>
                            await
                                endpoint.PublishToGalleryAsync("x48989", null, "ahj", true, true).ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
        public async Task RemoveFromGalleryAsync_WithOAuth2TokenNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.RemoveFromGalleryAsync("x48989").ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
        public async Task SearchGalleryAdvancedAsync_WithQueriesNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.SearchGalleryAdvancedAsync().ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
        public async Task GetGalleryTagImageAsync_DefaultParameters_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/gallery/t/cats/XoPkL";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockGalleryEndpointResponses.GetGalleryTagImage)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new GalleryEndpoint(client,
                new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var image = await endpoint.GetGalleryTagImageAsync("XoPkL", "cats").ConfigureAwait(false);

            Assert.NotNull(image);
        }