本文整理汇总了C#中CodeElement.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CodeElement.GetType方法的具体用法?C# CodeElement.GetType怎么用?C# CodeElement.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeElement
的用法示例。
在下文中一共展示了CodeElement.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateTest
/// <summary>
/// Generates a Unit Test for a Class
/// </summary>
/// <param name="unitTestCodeClass">Unit Test Class's Code Function. A shell will suffice</param>
/// <param name="codeElement">Class's Code Function or Code Property</param>
/// <param name="originalCodeClass">The class from which we have chosen our codeElement</param>
/// <returns>A CodeClass representation the newly generated class</returns>
public virtual CodeClass GenerateTest(CodeClass unitTestCodeClass, CodeClass originalCodeClass, CodeElement codeElement)
{
if (codeElement is CodeFunction || codeElement is CodeProperty)
{
string unitTestString = string.Empty;
unitTestCodeClass.Comment = originalCodeClass.Comment;
unitTestCodeClass.DocComment = originalCodeClass.DocComment;
foreach (CodeElement ce in originalCodeClass.Members)
{
if (ce == codeElement)
{
if (ce is CodeFunction && ((CodeFunction)ce).Access == vsCMAccess.vsCMAccessPublic)
{
GenerateTest(unitTestCodeClass, (CodeFunction)ce);
}
else if (ce is CodeProperty && ((CodeProperty)ce).Access == vsCMAccess.vsCMAccessPublic)
{
GenerateTest(unitTestCodeClass, (CodeProperty)ce);
}
}
}
return unitTestCodeClass;
}
else
throw new Exception(string.Format(UTGHelper.CommonErrors.ERR_TYPE_NOT_SUPPORTED, codeElement.GetType().ToString()));
}