/// <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; } }
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); }
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); }
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); }