Пример #1
0
        public string GetHentaiPic()
        {
            string albumId     = RandomAlbum();
            var    resultAlbum = Endpoint.GetAlbumAsync(albumId, "Absolutelumi").Result;

            return(resultAlbum.Images.ToArray().Random().ToString());
        }
Пример #2
0
        public async Task GetAlbumAsync_NotNull()
        {
            var mockUrl      = "https://api.imgur.com/3/account/sarah/album/yMgB7";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockAccountEndpointResponses.GetAlbum)
            };

            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var album    = await endpoint.GetAlbumAsync("yMgB7", "sarah").ConfigureAwait(false);

            Assert.NotNull(album);
            Assert.Equal("yMgB7", album.Id);
            Assert.Equal("Day 2 at Camp Imgur", album.Title);
            Assert.Equal(null, album.Description);
            Assert.Equal(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1439066984), album.DateTime);
            Assert.Equal("BOdd9Qd", album.Cover);
            Assert.Equal(5184, album.CoverWidth);
            Assert.Equal(3456, album.CoverHeight);
            Assert.Equal("sarah", album.AccountUrl);
            Assert.Equal(9571, album.AccountId);
            Assert.Equal(AlbumPrivacy.Public, album.Privacy);
            Assert.Equal(AlbumLayout.Blog, album.Layout);
            Assert.Equal(413310, album.Views);
            Assert.Equal("http://imgur.com/a/yMgB7", album.Link);
            Assert.Equal(false, album.Favorite);
            Assert.Equal(false, album.Nsfw);
            Assert.Equal("pics", album.Section);
            Assert.Equal(6, album.ImagesCount);
        }
Пример #3
0
        public async Task GetAlbumAsync_WithValidReponse_AreEqual()
        {
            var client   = new MashapeClient(ClientId, ClientSecret, MashapeKey);
            var endpoint = new AccountEndpoint(client);

            var album = await endpoint.GetAlbumAsync("SbU9Y", "sarah");

            Assert.IsNotNull(album);
        }
        public async Task GetAlbumAsync_IsNotNull()
        {
            var client   = new ImgurClient(ClientId, ClientSecret);
            var endpoint = new AccountEndpoint(client);

            var album = await endpoint.GetAlbumAsync("SbU9Y", "sarah");

            Assert.IsNotNull(album);
        }
        public async Task GetAlbumAsync_WithValidReponse_AreEqual()
        {
            var client   = new ImgurClient(ClientId, ClientSecret, OAuth2Token);
            var endpoint = new AccountEndpoint(client);

            var album = await endpoint.GetAlbumAsync("cuta6");

            Assert.IsNotNull(album);
        }
Пример #6
0
        public async Task GetAlbumAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);

            var exception =
                await
                Record.ExceptionAsync(
                    async() => await endpoint.GetAlbumAsync("yMgB7", null).ConfigureAwait(false))
                .ConfigureAwait(false);

            Assert.NotNull(exception);
            Assert.IsType <ArgumentNullException>(exception);
        }
 public async Task GetAlbumAsync_WithUsernameNull_ThrowsArgumentNullException()
 {
     var client   = new ImgurClient("123", "1234");
     var endpoint = new AccountEndpoint(client);
     await endpoint.GetAlbumAsync("yMgB7", null);
 }