Parameters of generating an image of a given textual string
상속: BaseParams
예제 #1
0
        /// <summary>
        /// Generate an image of a given textual string
        /// </summary>
        /// <param name="parameters">Parameters of generating an image of a given textual string</param>
        /// <returns>Results of generating an image of a given textual string</returns>
        public TextResult Text(TextParams parameters)
        {
            string uri = m_api.ApiUrlImgUpV.Action("text").BuildUrl();

            using (HttpWebResponse response = m_api.Call(HttpMethod.POST, uri, parameters.ToParamsDictionary(), null))
            {
                TextResult result = TextResult.Parse(response);
                return result;
            }
        }
예제 #2
0
        public void TestTextAlign()
        {
            TextParams tParams = new TextParams("Sample text.");
            tParams.Background = "red";
            tParams.FontStyle = "italic";
            tParams.TextAlign = "center";

            string rString = GetMockBodyOfCoudinaryRequest(tParams, (p, t) => { return p.Text(t); });

            StringAssert.Contains("name=\"text_align\"\r\n\r\ncenter\r\n", rString);
        }
예제 #3
0
        public void TestEnglishText()
        {
            TextParams tParams = new TextParams("Sample text.");
            tParams.Background = "red";
            tParams.FontStyle = "italic";
            TextResult textResult = m_cloudinary.Text(tParams);

            Assert.IsTrue(textResult.Width > 0);
            Assert.IsTrue(textResult.Height > 0);
        }
예제 #4
0
        public void TestPostParamsInTheBody()
        {
            TextParams tParams = new TextParams("Sample text.");
            tParams.Background = "red";
            tParams.FontStyle = "italic";
            tParams.TextAlign = "center";

            string rString = GetMockBodyOfCoudinaryRequest(tParams, (p, t) =>
            {
                p.Api.Call(HttpMethod.POST, string.Empty, t.ToParamsDictionary(), null);
                return (TextResult)null;
            });

            StringAssert.Contains("name=\"text_align\"\r\n\r\ncenter\r\n", rString);
        }