예제 #1
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);
        }
예제 #2
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);
        }
 /// <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 get method.
 /// </summary>
 /// <param name="url">
 /// The url.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// adds the get method prefix to the url for a get list REST method
 /// </returns>
 public static string AddGetMethod(this string url, WebPurifyListType type)
 {
     return url + "?method=webpurify.live.get" + ListTypeText(type);
 }
 /// <summary>
 /// The list type text.
 /// </summary>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// return Black or White
 /// </returns>
 public static string ListTypeText(WebPurifyListType type)
 {
     switch (type)
     {
         case WebPurifyListType.Black:
             return "blacklist";
         case WebPurifyListType.White:
         default:
             return "whitelist";
     }
 }
        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);
        }
예제 #7
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));
 }
 /// <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));
 }
예제 #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)));
 }
예제 #10
0
 /// <summary>
 /// The get list.
 /// </summary>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// WebPurifyGetListResponse object
 /// </returns>
 public WebPurifyGetListResponse GetList(WebPurifyListType type)
 {
     return(this.webPurifyService.GetList(this.GetGetMethodUrl(type)));
 }
        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);
        }
        public void GenerateCorrectGetListUrl(string methodname, WebPurifyListType type)
        {
            // arrange
            const string url = "{0}?method={1}&api_key={2}";
            string expectedurl = string.Format(url, _apiUrl, methodname, _apikey);

            // act
            string resulturl = _request.GetGetMethodUrl(type);

            // 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 get get method url.
 /// </summary>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// returns URL for Web Purify REST service.
 /// </returns>
 internal string GetGetMethodUrl(WebPurifyListType type)
 {
     return this.url.AddGetMethod(type).AddParam(WebPurifyArgument.ApiKey, this.key);
 }
예제 #15
0
 /// <summary>
 /// The add get method.
 /// </summary>
 /// <param name="url">
 /// The url.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// adds the get method prefix to the url for a get list REST method
 /// </returns>
 public static string AddGetMethod(this string url, WebPurifyListType type)
 {
     return(url + "?method=webpurify.live.get" + ListTypeText(type));
 }
예제 #16
0
 /// <summary>
 /// The get get method url.
 /// </summary>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// returns URL for Web Purify REST service.
 /// </returns>
 internal string GetGetMethodUrl(WebPurifyListType type)
 {
     return(this.url.AddGetMethod(type).AddParam(WebPurifyArgument.ApiKey, this.key));
 }
예제 #17
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 get list.
 /// </summary>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <returns>
 /// WebPurifyGetListResponse object
 /// </returns>
 public WebPurifyGetListResponse GetList(WebPurifyListType type)
 {
     return this.webPurifyService.GetList(this.GetGetMethodUrl(type));
 }