예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            InputData input = new InputData();
            input.Description = "test des for input";

            InputDataSet ds = new InputDataSet();
            ds.InputParameters.AddParameter("key1", "v1");
            ds.InputParameters.AddParameter("key2", "v2");
            ds.InputParameters.AddParameter("key3", "v3");

            ds.ExpectedValues.AddParameter("expected1", "v4");
            ds.ExpectedValues.AddParameter("expected2", "v5");
            ds.Key = "ds key1";
            ds.Description = "des des1";
            input.AddInputDataSet(ds);

            InputDataSet ds2 = new InputDataSet();
            ds2.InputParameters.AddParameter("key1", "v1");
            ds2.InputParameters.AddParameter("key2", "v2");
            ds2.InputParameters.AddParameter("key3", "v3");

            ds2.ExpectedValues.AddParameter("expected1", "v4");
            ds2.ExpectedValues.AddParameter("expected2", "v5");
            ds2.Key = "ds key2";
            ds2.Description = "des des2";
            input.AddInputDataSet(ds2);

            MessageBox.Show(input.Export("c:/test.xml").ToString());
        }
 /// <summary>
 /// insert a new dataset.
 /// </summary>
 /// <param name="dataset"></param>
 /// <returns></returns>
 public bool AddInputDataSet(InputDataSet dataset)
 {
     if (this.mDataSets.Contains(dataset))
         return false;
     else
     {
         this.mDataSets.Add(dataset);
         return true;
     }
 }
예제 #3
0
 /// <summary>
 /// insert a new dataset.
 /// </summary>
 /// <param name="dataset"></param>
 /// <returns></returns>
 public bool AddInputDataSet(InputDataSet dataset)
 {
     if (this.mDataSets.Contains(dataset))
     {
         return(false);
     }
     else
     {
         this.mDataSets.Add(dataset);
         return(true);
     }
 }
예제 #4
0
 /// <summary>
 /// remove the specified input dataset.
 /// </summary>
 /// <param name="dataset"></param>
 /// <returns></returns>
 public bool RemoveInputDataSet(InputDataSet dataset)
 {
     if (this.mDataSets.Contains(dataset))
     {
         this.mDataSets.Remove(dataset);
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public Round(XmlNode round)
        {
            this.mKey     = round.Attributes["Key"].Value;
            this.mDes     = round.Attributes["Des"].Value;
            this.mTime    = Convert.ToInt32(round.Attributes["Time"].Value);
            this.mDataSet = new InputDataSet(round.SelectSingleNode("DataSet"));

            XmlNodeList cps = round.SelectNodes("CheckPoint");

            foreach (XmlNode cp in cps)
            {
                this.CheckPoints.Add(new CheckPoint(cp));
            }
        }
예제 #6
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() == this.GetType())
            {
                InputDataSet set = obj as InputDataSet;

                if (set.Key == this.Key)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        private void InsertDataSet(InputDataSet ids)
        {
            UltraTreeNode dsNode = this.InputTree.Nodes.Add(ids.Key);

            dsNode.Override.ColumnSet = this.InputTree.ColumnSettings.ColumnSets["DataSet"];

            dsNode.Cells[0].Value = ids.Key;
            dsNode.Cells[1].Value = ids.Description;

            dsNode.Tag = 0;

            UltraTreeNode inputParameterNode = dsNode.Nodes.Add();
            inputParameterNode.Tag = 1;
            inputParameterNode.Text = "Input Parameters";

            foreach (Step s in ids.InputParameters.Steps)
            {
                InsertStep(inputParameterNode, s);
            }

            UltraTreeNode expectedResultNode = dsNode.Nodes.Add();
            expectedResultNode.Tag = 1;
            expectedResultNode.Text = "Expected Result";

            foreach (Step s in ids.ExpectedValues.Steps)
            {
                InsertStep(expectedResultNode, s);
            }
        }
        /// <summary>
        /// initialize with xml string.
        /// </summary>
        /// <param name="xmlContent"></param>
        public void LoadFromXml(string xmlContent)
        {
            XmlDocument doc = new XmlDocument();
            this.mDataSets.Clear();

            try
            {
                doc.LoadXml(xmlContent);
                XmlNode root = doc.SelectSingleNode("Input");

                //set description.
                foreach (XmlAttribute a in root.Attributes)
                {
                    if (a.Name.ToUpper() == "DES")
                    {
                        this.mDes = a.Value;
                        break;
                    }
                }

                //add datasets.
                XmlNodeList datasets = root.SelectNodes("DataSet");
                foreach (XmlNode dataset in datasets)
                {
                    InputDataSet set = new InputDataSet(dataset);
                    this.AddInputDataSet(set);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 /// <summary>
 /// remove the specified input dataset.
 /// </summary>
 /// <param name="dataset"></param>
 /// <returns></returns>
 public bool RemoveInputDataSet(InputDataSet dataset)
 {
     if (this.mDataSets.Contains(dataset))
     {
         this.mDataSets.Remove(dataset);
         return true;
     }
     else
         return false;
 }