本文整理汇总了C#中Tags.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Tags.Add方法的具体用法?C# Tags.Add怎么用?C# Tags.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMethodTags
/// <summary>
/// Reflect, read and prepare the tags for the method metadata. Performs
/// the work if this is the first time the metadata has been seen.
/// </summary>
/// <param name="method">The method metadata.</param>
private void CreateMethodTags(ITestMethod method)
{
MethodInfo m = method.Method;
// 1. All the tags from the class
Tags tags = new Tags(_classTags);
// 2. Method.Name
tags.Add(m.Name);
// 3. Type.FullName + Method.Name
tags.Add(m.ReflectedType.FullName + "." + m.Name);
// 4. Type.Name + Method.Name
tags.Add(m.ReflectedType.Name + "." + m.Name);
// 5. Implicit Inherited tag
if (m.ReflectedType != m.DeclaringType)
{
tags.Add("Inherited");
}
// 6. All [Tag] attributes on the method
foreach (Attribute attribute in ReflectionUtility.GetAttributes(method, TagType, false))
{
tags.Add(attribute);
}
// 7. Type.Namespace
tags.Add (m.ReflectedType.Namespace);
_methodTags.Add(method, tags);
foreach (string tag in tags)
{
List<ITestMethod> methods;
if (!_tagsToMethods.TryGetValue(tag, out methods))
{
methods = new List<ITestMethod>();
_tagsToMethods[tag] = methods;
}
methods.Add(method);
}
}
示例2: ConvertPropertyFromJson
object ConvertPropertyFromJson(string objectName, object value, Type propType)
{
if (value == null)
return null;
var uType = Nullable.GetUnderlyingType(propType);
if (uType!=null && uType!=propType) //is nullable
{
propType = uType;
}
if (propType == typeof(Int64))
{
return (value);
}
else if (propType == typeof(Decimal))
{
return (value);
}
else if (propType == typeof(string))
{
return value;
}
else if (propType == typeof(bool))
{
if (value is string)
{
return ParseBool((string)(value));
}
if (value is long)
{
return 0 == ((long)(value));
}
return value;
}
else if (propType == typeof(DateTime))
{
return ParseFacebookDateTime((long)value);
}
else if (propType == typeof(FolderId))
{
return (FolderId) Enum.Parse(typeof(FolderId), (string) value);
}
else if (propType == typeof(StreamType))
{
return (StreamType)((long)value);
}
else if (propType == typeof(Coords))
{
return new Coords((JsonObject)value);
}
else if (propType == typeof(Venue))
{
return new Venue((JsonObject)value);
}
else if (propType == typeof(LikeInfo))
{
return new LikeInfo((JsonObject)value);
}
else if (propType == typeof(CommentInfo))
{
return new CommentInfo((JsonObject)value);
}
else if (propType == typeof(Devices))
{
return new Devices((JsonArray)value);
}
else if (propType == typeof(Tags))
{
if (value is JsonArray)
{
return new Tags((JsonArray)value);
}
else
{
var res = new Tags();
res.Add(new Tag((JsonObject)value));
return res;
}
}
else if (propType == typeof(Genders))
{
return new Genders((JsonArray)value);
}
else if (propType == typeof(Developers))
{
return new Developers((JsonArray)value);
}
else if (propType == typeof(AppDomains))
{
return new AppDomains((JsonArray)value);
}
else if (propType == typeof(UserStatus))
{
return new UserStatus((JsonObject)value);
}
else if (propType == typeof(Auths))
{
return new Auths((JsonArray)value);
}
else if (propType == typeof(HometownLocationType))
//.........这里部分代码省略.........
示例3: tags
// $ANTLR end "feature"
// $ANTLR start "tags"
// SpecFlowLangWalker.g:37:1: tags returns [Tags tags] : ^( TAGS (tag_= tag )+ ) ;
public Tags tags() // throws RecognitionException [1]
{
Tags tags = default(Tags);
Tag tag_ = default(Tag);
tags = new Tags();
try
{
// SpecFlowLangWalker.g:41:5: ( ^( TAGS (tag_= tag )+ ) )
// SpecFlowLangWalker.g:41:9: ^( TAGS (tag_= tag )+ )
{
Match(input,TAGS,FOLLOW_TAGS_in_tags251);
Match(input, Token.DOWN, null);
// SpecFlowLangWalker.g:42:13: (tag_= tag )+
int cnt5 = 0;
do
{
int alt5 = 2;
int LA5_0 = input.LA(1);
if ( (LA5_0 == TAG) )
{
alt5 = 1;
}
switch (alt5)
{
case 1 :
// SpecFlowLangWalker.g:42:14: tag_= tag
{
PushFollow(FOLLOW_tag_in_tags268);
tag_ = tag();
state.followingStackPointer--;
tags.Add(tag_);
}
break;
default:
if ( cnt5 >= 1 ) goto loop5;
EarlyExitException eee5 =
new EarlyExitException(5, input);
throw eee5;
}
cnt5++;
} while (true);
loop5:
; // Stops C# compiler whinging that label 'loop5' has no statements
Match(input, Token.UP, null);
}
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return tags;
}