Inheritance: RequestBuilderBase
        public void ReportItemRequest_WithUrlNull_ThrowsArgumentNullException()
        {
            var requestBuilder = new AccountRequestBuilder();

            var exception = Record.Exception(() => requestBuilder.ReportItemRequest(null, ReportReason.Abusive));
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);

            var argNullException = (ArgumentNullException) exception;
            Assert.Equal(argNullException.ParamName, "url");
        }
        public void CreateRequest_WithUrlNull_ThrowsArgumentNullException()
        {
            var requestBuilder = new AccountRequestBuilder();

            var exception = Record.Exception(() => requestBuilder.CreateRequest(HttpMethod.Get, null));
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);

            var argNullException = (ArgumentNullException) exception;
            Assert.Equal(argNullException.ParamName, "url");
        }
        public void UpdateAccountSettingsRequest_WithUrlNull_ThrowsArgumentNullException()
        {
            var requestBuilder = new AccountRequestBuilder();

            var exception = Record.Exception(() => requestBuilder.UpdateAccountSettingsRequest(null));
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);

            var argNullException = (ArgumentNullException) exception;
            Assert.Equal(argNullException.ParamName, "url");
        }
Ejemplo n.º 4
0
        public void CreateRequest_AreEqual()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new AccountRequestBuilder();

            var url = $"{client.EndpointUrl}account/bob";
            var request = requestBuilder.CreateRequest(HttpMethod.Get, url);

            Assert.IsNotNull(request);
            Assert.AreEqual("https://api.imgur.com/3/account/bob", request.RequestUri.ToString());
            Assert.AreEqual(HttpMethod.Get, request.Method);
        }
        public async Task UpdateAccountSettingsRequest_Equal()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new AccountRequestBuilder();

            var mockUrl = $"{client.EndpointUrl}account/me/settings";
            var request = requestBuilder.UpdateAccountSettingsRequest(
                mockUrl, "BioTest", true, true, AlbumPrivacy.Public,
                true, "Bob2", true, true);

            Assert.NotNull(request);
            var expected =
                "public_images=true&messaging_enabled=true&album_privacy=public&accepted_gallery_terms=true&show_mature=true&newsletter_subscribed=true&bio=BioTest&username=Bob2";

            Assert.Equal(expected, await request.Content.ReadAsStringAsync().ConfigureAwait(false));
            Assert.Equal("https://api.imgur.com/3/account/me/settings", request.RequestUri.ToString());
            Assert.Equal(HttpMethod.Post, request.Method);
        }
Ejemplo n.º 6
0
 public void CreateRequest_WithUrlNull_ThrowsArgumentNullException()
 {
     var requestBuilder = new AccountRequestBuilder();
     requestBuilder.CreateRequest(HttpMethod.Get, null);
 }
 public void UpdateAccountSettingsRequest_WithUrlNull_ThrowsArgumentNullException()
 {
     var requestBuilder = new AccountRequestBuilder();
     requestBuilder.UpdateAccountSettingsRequest(null);
 }