private void AddTag_Click(object sender, RoutedEventArgs e)
        {
            var tag    = new Tag("", "");
            var result = new EditTagWindow(tag).ShowDialog();

            if (result == true)
            {
                Tags.Add(tag);
                db.Tags.Add(tag);
            }
        }
Esempio n. 2
0
 public BespokeFact(Func <TestExecutionContext, object> func, TestName baseName, TestOptions opts) : base(func.Method)
 {
     _baseName = baseName;
     _func     = func;
     _name     = opts.Name;
     Filters.AddAll(opts.Filters);
     Timeout        = opts.Timeout;
     PassExplicitly = opts.PassExplicitly;
     Reason         = opts.Reason;
     Tags.Add(TestTag.Dynamic);
 }
Esempio n. 3
0
 public Fire(ComponentManager manager, Vector3 pos) :
     base(manager, "Fire", Matrix.CreateTranslation(pos), Vector3.One, Vector3.Zero)
 {
     CollisionType = CollisionType.Static;
     Tags.Add("Fire");
     AddChild(new Flammable(manager, "Flammable")
     {
         Heat = 999,
     });
     AddChild(new Health(manager, "Health", 10.0f, 0.0f, 10.0f));
 }
Esempio n. 4
0
 public void Tag(int tag)
 {
     if (Tags.Contains(tag) == false)
     {
         Tags.Add(tag);
         if (Scene != null)
         {
             Scene.TagLists[tag].Add(this);
         }
     }
 }
        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))
            {
                return new HometownLocationType((JsonObject)value);
            }
            else if (propType.IsEnum)
            {
                return ParseFacebookEnum(propType, value as string);
            }
            else if (value is Facebook.JsonObject)
            {
                return value;
            }
            else if (value is Facebook.JsonArray)
            {
                if ((value as Facebook.JsonArray).Count == 0)
                {
                    return null;
                }
                if (propType == typeof(UidsList))
                {
                    return new UidsList((JsonArray)value);
                }
                if (propType == typeof(Urls))
                {
                    return new Urls((JsonArray)value);
                }
                return value;
            }
            else if (propType == typeof(Uid))
            {
                string val = FixValueForId(value);
                return new Uid(val);
            }
            else if (propType == typeof(AppId))
            {
                string val = FixValueForId(value);
                return new AppId(val);
            }
            else if (propType == typeof(DomainId))
            {
                string val = FixValueForId(value);
                return new DomainId(val);
            }
            else if (propType == typeof(StatusId))
            {
                string val = FixValueForId(value);
                return new StatusId(val);
            }
            else if (propType == typeof(RequestId))
            {
                string val = FixValueForId(value);
                return new RequestId(val);
            }
            else if (propType == typeof(CheckinId))
            {
                string val = FixValueForId(value);
                return new CheckinId(val);
            }
            else if (propType == typeof(PageId))
            {
                string val = FixValueForId(value);
                return new PageId(val);
            }
            else if (propType == typeof(PostId))
            {
                string val = FixValueForId(value);
                return new PostId(val);
            }
            else if (propType == typeof(EventId))
            {
                string val = FixValueForId(value);
                return new EventId(val);
            }
            else if (propType == typeof(FriendListId))
            {
                string val = FixValueForId(value);
                return new FriendListId(val);
            }
            else if (propType == typeof(LinkId))
            {
                string val = FixValueForId(value);
                return new LinkId(val);
            }
            else if (propType == typeof(GroupId))
            {
                string val = FixValueForId(value);
                return new GroupId(val);
            }
            else if (propType == typeof(ThreadId))
            {
                string val = FixValueForId(value);
                return new ThreadId(val);
            }
            else if (propType == typeof(NotificationId))
            {
                string val = FixValueForId(value);
                return new NotificationId(val);
            }
            else if (propType == typeof(OfferId))
            {
                string val = FixValueForId(value);
                return new OfferId(val);
            }
            else if (propType == typeof(MilestoneId))
            {
                string val = FixValueForId(value);
                return new MilestoneId(val);
            }
            else if (propType == typeof(PhotoId))
            {
                string val = FixValueForId(value);
                return new PhotoId(val);
            }
            else if (propType == typeof(ReviewId))
            {
                string val = FixValueForId(value);
                return new ReviewId(val);
            }
            else if (propType == typeof(MessageId))
            {
                string val = FixValueForId(value);
                return new MessageId(val);
            }
            else if (propType == typeof(VideoId))
            {
                string val = FixValueForId(value);
                return new VideoId(val);
            }
            else if (propType == typeof(VideoId))
            {
                string val = FixValueForId(value);
                return new VideoId(val);
            }
            else if (propType == typeof(CommentId))
            {
                string val = FixValueForId(value);
                return new CommentId(val);
            }
            else if (propType == typeof(ObjectUrlId))
            {
                string val = FixValueForId(value);
                return new ObjectUrlId(val);
            }
            else if (propType == typeof(ProfileId))
            {
                string val = FixValueForId(value);
                return new ProfileId(val);
            }
            else if (propType == typeof(QuestionId))
            {
                string val = FixValueForId(value);
                return new QuestionId(val);
            }
            else if (propType == typeof(QuestionOptionId))
            {
                string val = FixValueForId(value);
                return new QuestionOptionId(val);
            }
            else if (propType == typeof(NoteId))
            {
                string val = FixValueForId(value);
                return new NoteId(val);
            }
            else if (propType == typeof(AlbumId))
            {
                string val = FixValueForId(value);
                return new AlbumId(val);
            }
            else if (propType == typeof(UnionId))
            {
                string val = FixValueForId(value);
                return new UnionId(val);
            }
            else if (propType == typeof(SubjectId))
            {
                string val = FixValueForId(value);
                return new SubjectId(val);
            }
            else if (propType == typeof(ConnectionTargetId))
            {
                string val = FixValueForId(value);
                return new ConnectionTargetId(val);
            }
            else if (propType == typeof(StreamTargetId))
            {
                string val = FixValueForId(value);
                return new StreamTargetId(val);
            }
            else if (propType == typeof(DomainOwnerId))
            {
                string val = FixValueForId(value);
                return new DomainOwnerId(val);
            }
            else if (propType == typeof(ObjectId))
            {
                string val = FixValueForId(value);
                return new ObjectId(val);
            }
            else if (propType == typeof(ThirdPartyId))
            {
                string val = FixValueForId(value);
                return new ThirdPartyId(val);
            }
            else if (propType == typeof(Xid))
            {
                string val = FixValueForId(value);
                return new Xid(val);
            }
            else if (propType == typeof(Fid))
            {
                string val = FixValueForId(value);
                return new Fid(val);
            }
            else
                throw new NotImplementedException();
        }
Esempio n. 6
0
        /// <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);
            }
        }
    // $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;
    }