本文整理汇总了C#中CloudinaryDotNet.Actions.ImageUploadParams.AddCustomParam方法的典型用法代码示例。如果您正苦于以下问题:C# ImageUploadParams.AddCustomParam方法的具体用法?C# ImageUploadParams.AddCustomParam怎么用?C# ImageUploadParams.AddCustomParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CloudinaryDotNet.Actions.ImageUploadParams
的用法示例。
在下文中一共展示了ImageUploadParams.AddCustomParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAdHocParams
public void TestAdHocParams()
{
var breakpoint = new ResponsiveBreakpoint().MaxImages(5).BytesStep(20)
.MinWidth(200).MaxWidth(1000).CreateDerived(false);
ImageUploadParams uploadParams = new ImageUploadParams()
{
File = new FileDescription(m_testImagePath)
};
uploadParams.AddCustomParam("public_id", "test_ad_hoc_params_id");
uploadParams.AddCustomParam("tags", "test");
uploadParams.AddCustomParam("IgnoredEmptyParameter", "");
uploadParams.AddCustomParam("responsive_breakpoints", JsonConvert.SerializeObject(new List<ResponsiveBreakpoint> { breakpoint }));
uploadParams.AddCustomParam("IgnoredNullParameter", null);
var paramsDict = uploadParams.ToParamsDictionary();
Assert.AreEqual(3, paramsDict.Count);
Assert.IsFalse(paramsDict.ContainsKey("IgnoredEmptyParameter"));
Assert.IsFalse(paramsDict.ContainsKey("IgnoredNullParameter"));
ImageUploadResult result = m_cloudinary.Upload(uploadParams);
Assert.AreEqual(1, result.ResponsiveBreakpoints.Count);
Assert.AreEqual(5, result.ResponsiveBreakpoints[0].Breakpoints.Count);
Assert.AreEqual(1000, result.ResponsiveBreakpoints[0].Breakpoints[0].Width);
Assert.AreEqual(200, result.ResponsiveBreakpoints[0].Breakpoints[4].Width);
}