public void SaveFormMapping(Uri uri, FormMappingDataRelationList relations, Hashtable postDataValues, HtmlFormTag form)
        {
            // create new formMapData
            FormMapData formMapData = new FormMapData();
            formMapData.FormTag = form;
            formMapData.PostData = postDataValues;
            formMapData.FormMappingRelations = relations;

            // Save .gbmap file.
            this.AddFormMapping(uri, formMapData);
        }
 /// <summary>
 /// Form that manages unit tests for a form.
 /// </summary>
 /// <param name="form"></param>
 /// <param name="sessionData"></param>
 public UnitTestManagerForm(HtmlFormTag form, ResponseBuffer sessionData, InspectorConfiguration config)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     this.inspectorConfig = config;
     this.CurrentForm = form;
     this.lblFormName.Text = form.Name;
     this.lblUrl.Text = ((Uri)sessionData.RequestHeaderCollection["Request Uri"]).AbsoluteUri;
 }
        /// <summary>
        /// Creates a new SessionFormEditor.
        /// </summary>
        /// <param name="form"> Form collection to load.</param>
        public SessionFormEditor(HtmlFormTag form)
            : this()
        {
            if ( form != null )
            {
                HtmlFormTagCollection forms = new HtmlFormTagCollection(1);
                forms.Add(form.Name, form);

                // Load tree
                LoadFormTree(forms);
            }
        }
 /// <summary>
 /// Creates a new HtmlFormTag.
 /// </summary>
 /// <param name="original"> The original form tag.</param>
 public HtmlFormTag(HtmlFormTag original)
 {
     innerHash = new Hashtable (original.innerHash);
 }
 internal HtmlFormTagEnumerator(HtmlFormTag enumerable)
 {
     innerEnumerator = enumerable.InnerHash.GetEnumerator();
 }
        public HtmlFormTag Clone()
        {
            HtmlFormTag clone = new HtmlFormTag();
            clone.innerHash = (Hashtable) innerHash.Clone();

            return clone;
        }
        public static HtmlFormTag Synchronized(HtmlFormTag nonSync)
        {
            HtmlFormTag sync = new HtmlFormTag();
            sync.innerHash = Hashtable.Synchronized(nonSync.innerHash);

            return sync;
        }
        private void SetFormValues(HtmlFormTag form)
        {
            foreach (DictionaryEntry dd in form)
            {
                FormEditorNode child = new FormEditorNode();
                HtmlTagBaseList controlArray = (HtmlTagBaseList)dd.Value;
                int controlIndex = 0;

                #region inner loop
                foreach (HtmlTagBase tag in controlArray)
                {
                    //					// A tags
                    //					if (tag is HtmlALinkTag)
                    //					{
                    //						HtmlALinkTag a=(HtmlALinkTag)tag;
                    //						scriptParser.etValue(this.HTMLDocument,a.Id,a.Id,"a",controlIndex,)
                    //						a.Text = ;
                    //					}

                    // Input tags
                    if (tag is HtmlInputTag)
                    {
                        HtmlInputTag input=(HtmlInputTag)tag;
                        scriptParser.SetFormValue(this.HTMLDocument,input.Id,input.Name,form.FormIndex,controlIndex,input.Value);
                    }

                    // Button tags
                    if (tag is HtmlButtonTag)
                    {
                        HtmlButtonTag button = (HtmlButtonTag)tag;
                        scriptParser.SetFormValue(this.HTMLDocument,button.Id,button.Name,form.FormIndex,controlIndex,button.Value);
                    }

                    // Select tags
                    if (tag is HtmlSelectTag)
                    {
                        HtmlSelectTag select = (HtmlSelectTag)tag;
                        scriptParser.SetFormValue(this.HTMLDocument,select.Id,select.Name,form.FormIndex,controlIndex,select.Value);

                    }

                    // Textarea tags
                    if (tag is HtmlTextAreaTag)
                    {
                        HtmlTextAreaTag textarea=(HtmlTextAreaTag)tag;
                        scriptParser.SetFormValue(this.HTMLDocument,textarea.Id,textarea.Name,form.FormIndex,controlIndex,textarea.Value);

                    }

                    controlIndex++;
                }
                #endregion
            }
        }
        private FormMappingDataRelationList CreateFormMappingRelations(Hashtable postData, HtmlFormTag formTag)
        {
            FormMappingDataRelationList relationList = new FormMappingDataRelationList();

            foreach ( DictionaryEntry de in formTag )
            {
                HtmlTagBaseList controlArray = (HtmlTagBaseList)de.Value;

                #region Tag Collection
                foreach ( HtmlTagBase tag in controlArray )
                {
                    string name = string.Empty;

                    if (tag is HtmlInputTag)
                    {
                        HtmlInputTag input=(HtmlInputTag)tag;
                        name = input.Name;
                    }

                    if (tag is HtmlButtonTag)
                    {
                        HtmlButtonTag button = (HtmlButtonTag)tag;
                        name = button.Name;
                    }

                    if (tag is HtmlSelectTag)
                    {
                        HtmlSelectTag select = (HtmlSelectTag)tag;
                        name = select.Name;
                    }

                    if (tag is HtmlTextAreaTag)
                    {
                        HtmlTextAreaTag textarea=(HtmlTextAreaTag)tag;
                        name = textarea.Name;
                    }

                    FormMappingDataRelation relation = new FormMappingDataRelation();
                    relation.CurrentValue = (string)postData[name];
                    relation.FieldName = name;

                    relationList.Add(relation);
                    //relation.FormMappingCopyType = FormMappingDataTransformation.
                }
                #endregion
            }

            return relationList;
        }
        private HtmlFormTag CloneFormTag()
        {
            HtmlFormTag formTag = new HtmlFormTag();

            formTag.Action = this.SelectedForm.Action;
            formTag.Class = this.SelectedForm.Class;
            formTag.Enctype = this.SelectedForm.Enctype;
            formTag.FormIndex = this.SelectedForm.FormIndex;
            formTag.Id = this.SelectedForm.Id;
            formTag.Method = this.SelectedForm.Method;
            formTag.Name = this.SelectedForm.Name;
            formTag.OnClick = this.SelectedForm.OnClick;
            formTag.OnSubmit = this.SelectedForm.OnSubmit;
            formTag.Style = this.SelectedForm.Style;
            formTag.Title = this.SelectedForm.Title;

            HtmlTagBaseList tagList = new HtmlTagBaseList();

            #region Add Tags
            foreach ( TreeNode node in formNodes.Nodes[0].Nodes )
            {
                if (node.Tag is HtmlInputTag)
                {
                    HtmlInputTag input=(HtmlInputTag)node.Tag;
                    tagList.Add(input);
                }

                if (node.Tag is HtmlButtonTag)
                {
                    HtmlButtonTag button = (HtmlButtonTag)node.Tag;
                    tagList.Add(button);
                }

                if (node.Tag is HtmlSelectTag)
                {
                    HtmlSelectTag select = (HtmlSelectTag)node.Tag;
                    tagList.Add(select);
                }

                if (node.Tag is HtmlTextAreaTag)
                {
                    HtmlTextAreaTag textarea=(HtmlTextAreaTag)node.Tag;
                    tagList.Add(textarea);
                }
            }
            #endregion

            formTag.Add(formTag.Name, tagList);

            return formTag;
        }
 private HtmlFormTag ApplyTestToForm(Test t, HtmlFormTag f)
 {
     UnitTester tester = new UnitTester(t.Arguments);
     return tester.BuildUnitTest(t.TestType,f);
 }