本文整理汇总了C#中IServices.GetComponentInfo方法的典型用法代码示例。如果您正苦于以下问题:C# IServices.GetComponentInfo方法的具体用法?C# IServices.GetComponentInfo怎么用?C# IServices.GetComponentInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServices
的用法示例。
在下文中一共展示了IServices.GetComponentInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetComponentInfo
private void GetComponentInfo(IServices svc, string logRef)
{
Template tmp = Util.OpenTemplate("d1f7cade-cb74-4457-a9a0-27d94f5c2d5b");
Server.Contracts.ComponentInfo result;
// Ensure that invalid parameters are throwing appropriate exceptions.
try
{
result = svc.GetComponentInfo(null, false, null);
Assert.Fail(); // Should not reach here with a null template.
}
catch (ArgumentNullException ex)
{
Assert.IsTrue(ex.Message.Contains("template"));
}
catch (Exception)
{
Assert.Fail(); // We are not expecting any generic exceptions.
}
result = svc.GetComponentInfo(tmp, false, logRef);
Assert.IsNull(result.Dialogs); // We did not request dialogs.
Assert.AreEqual(result.Variables.Count, 20);
// Now try it again, but request dialogs this time.
result = svc.GetComponentInfo(tmp, true, logRef);
Assert.IsNotNull(result.Dialogs); // We did request dialogs this time.
Assert.AreEqual(result.Dialogs.Count, 4);
Assert.AreEqual(result.Variables.Count, 20);
}