Example #1
0
        /// <summary>
        /// The list method text.
        /// </summary>
        /// <param name="method">
        /// The method.
        /// </param>
        /// <returns>
        /// Returns either Add or Remove
        /// </returns>
        public static string ListMethodText(WebPurifyListMethod method)
        {
            switch (method)
            {
            case WebPurifyListMethod.Add:
                return("?method=webpurify.live.addto");

            case WebPurifyListMethod.Remove:
            default:
                return("?method=webpurify.live.removefrom");
            }
        }
Example #2
0
        public void GenerateCorrectManageListUrl(
            string methodname, WebPurifyListMethod method, WebPurifyListType type, string word)
        {
            // arrange
            const string url         = "{0}?method={1}&api_key={2}&word={3}";
            string       expectedurl = string.Format(url, _apiUrl, methodname, _apikey, word);

            // act
            string resulturl = _request.GetManageListUrl(method, type, word);

            // assert
            Assert.AreEqual(expectedurl, resulturl);
        }
Example #3
0
        public void ReturnCorrectWebPurifyCheckResponseForManageListRequest(
            WebPurifyListMethod method, WebPurifyListType type, string word, bool success)
        {
            // arrange
            var expectedResponse = new WebPurifyManageListResponse {
                Success = success
            };

            // act
            var resultResponse = _request.ManageList(WebPurifyListMethod.Add, WebPurifyListType.White, word);

            // assert
            Assert.AreEqual(expectedResponse.Success, resultResponse.Success);
        }
Example #4
0
 /// <summary>
 /// The add method.
 /// </summary>
 /// <param name="url">
 /// The url.
 /// </param>
 /// <param name="method">
 /// The method.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// add the web purify REST list method to the url.
 /// </returns>
 public static string AddMethod(this string url, WebPurifyListMethod method, WebPurifyListType type)
 {
     return(url + ListMethodText(method) + ListTypeText(type));
 }
 /// <summary>
 /// The add method.
 /// </summary>
 /// <param name="url">
 /// The url.
 /// </param>
 /// <param name="method">
 /// The method.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// add the web purify REST list method to the url.
 /// </returns>
 public static string AddMethod(this string url, WebPurifyListMethod method, WebPurifyListType type)
 {
     return url + ListMethodText(method) + ListTypeText(type);
 }
 /// <summary>
 /// The list method text.
 /// </summary>
 /// <param name="method">
 /// The method.
 /// </param>
 /// <returns>
 /// Returns either Add or Remove
 /// </returns>
 public static string ListMethodText(WebPurifyListMethod method)
 {
     switch (method)
     {
         case WebPurifyListMethod.Add:
             return "?method=webpurify.live.addto";
         case WebPurifyListMethod.Remove:
         default:
             return "?method=webpurify.live.removefrom";
     }
 }
        public void ReturnCorrectWebPurifyCheckResponseForManageListRequest(
            WebPurifyListMethod method, WebPurifyListType type, string word, bool success)
        {
            // arrange
            var expectedResponse = new WebPurifyManageListResponse { Success = success };

            // act
            var resultResponse = _request.ManageList(WebPurifyListMethod.Add, WebPurifyListType.White, word);

            // assert
            Assert.AreEqual(expectedResponse.Success, resultResponse.Success);
        }
Example #8
0
 /// <summary>
 /// The get manage list url.
 /// </summary>
 /// <param name="method">
 /// The method.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="word">
 /// The word.
 /// </param>
 /// <returns>
 /// returns URL for Web Purify REST service.
 /// </returns>
 internal string GetManageListUrl(WebPurifyListMethod method, WebPurifyListType type, string word)
 {
     return
         (this.url.AddMethod(method, type).AddParam(WebPurifyArgument.ApiKey, this.key).AddParam(
              WebPurifyArgument.ListWord, word));
 }
Example #9
0
 /// <summary>
 /// The manage list.
 /// </summary>
 /// <param name="method">
 /// The method.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="word">
 /// The word.
 /// </param>
 /// <returns>
 /// WebPurifyManageListResponse object
 /// </returns>
 public WebPurifyManageListResponse ManageList(WebPurifyListMethod method, WebPurifyListType type, string word)
 {
     return(this.webPurifyService.ManageList(this.GetManageListUrl(method, type, word)));
 }
        public void GenerateCorrectManageListUrl(
            string methodname, WebPurifyListMethod method, WebPurifyListType type, string word)
        {
            // arrange
            const string url = "{0}?method={1}&api_key={2}&word={3}";
            string expectedurl = string.Format(url, _apiUrl, methodname, _apikey, word);

            // act
            string resulturl = _request.GetManageListUrl(method, type, word);

            // assert
            Assert.AreEqual(expectedurl, resulturl);
        }
 /// <summary>
 /// The get manage list url.
 /// </summary>
 /// <param name="method">
 /// The method.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="word">
 /// The word.
 /// </param>
 /// <returns>
 /// returns URL for Web Purify REST service.
 /// </returns>
 internal string GetManageListUrl(WebPurifyListMethod method, WebPurifyListType type, string word)
 {
     return
         this.url.AddMethod(method, type).AddParam(WebPurifyArgument.ApiKey, this.key).AddParam(
             WebPurifyArgument.ListWord, word);
 }
 /// <summary>
 /// The manage list.
 /// </summary>
 /// <param name="method">
 /// The method.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="word">
 /// The word.
 /// </param>
 /// <returns>
 /// WebPurifyManageListResponse object
 /// </returns>
 public WebPurifyManageListResponse ManageList(WebPurifyListMethod method, WebPurifyListType type, string word)
 {
     return this.webPurifyService.ManageList(this.GetManageListUrl(method, type, word));
 }