public TestParameters Parse(Stream stream)
        {
            var     serializer = new XmlSerializer(typeof(XmlTest));
            XmlTest test       = null;

            using (var reader = new StreamReader(stream)) {
                test = (XmlTest)serializer.Deserialize(reader);
            }

            var deviceModel = (EDeviceModel)Enum.Parse(typeof(EDeviceModel), test.deviceModel);
            var sensorType  = (ESensorType)Enum.Parse(typeof(ESensorType), test.sensorType);

            var targetPoints = new List <TestParameters.TargetPoint>();

            foreach (var xtp in test.targetPoints.targetPoints)
            {
                var unit = UnitLookup.GetUnit(sensorType, xtp.unit);
                targetPoints.Add(new TestParameters.TargetPoint(unit.OfScalar(xtp.amount)));
            }

            var grades = new HashSet <TestParameters.Grade>();

            foreach (var xg in test.gradeScale.grades)
            {
                grades.Add(new TestParameters.Grade(xg.errorBand, xg.grade, xg.passable));
            }

            return(new TestParameters(deviceModel, sensorType, targetPoints, grades));
        }
Пример #2
0
 public bool Equals(File other)
 {
     return(other != null &&
            XmlTest.Equals(other.XmlTest) &&
            ProtoTest.Equals(other.ProtoTest) &&
            IgnoreField.Equals(other.IgnoreField));
 }
        public XmlTest Check(Expression <Func <TMappingType, object> > sourceProperty, object value)
        {
            var test = new XmlTest(sourceProperty, value);

            _tests.Add(test);
            return(test);
        }
        private TestResults ExecuteTest(int i)
        {
            if (i >= this.Count)
            {
                return(new TestResults("i > Count", true));
            }

            XmlTest test = this.Tests[i];
            var     b    = test.RunTest();

            return(new TestResults(test.Description, b));
        }
Пример #5
0
        static void Main(string[] args)
        {
            XmlTest test = new XmlTest();

            // 写.
            test.TestWrite();

            // 读.
            test.TestRead();

            Console.ReadLine();
        }
Пример #6
0
        public Exec()
        {
            InitializeComponent();

            XMLTest = new XmlTest(new XmlUtil());

            XMLProyect = new XmlProyect(new XmlUtil());

            XMLTestQuery = new XmlTestQuery(new XmlUtil(), this.DataGridPruebas);

            UpdateListProyects();

            UpdateListEnverioments();
        }
Пример #7
0
        private void button3_Click(object sender, EventArgs e)
        {
            //创建范例表表
            Address          ar  = new Address();
            XmlLivingExample XLE = new XmlLivingExample();

            XLE.HouseNo    = 4;
            XLE.StreetName = "Rohini";
            XLE.City       = "Delhi";
            XLE.PoAddress  = "asd";

            ar.HouseNo = XLE.HouseNo * 1;
            ar.Data    = XLE.StreetName;

            XLE.Address = ar;
            string erro = "";

            //判断写入单表xml是否成功
            if (!XmlTest <XmlLivingExample> .Serialize(XLE, "Config.xml", ref erro))
            {
                MessageBox.Show(erro);
            }
            //创建反序列化表
            XmlLivingExample XLE_DS = new XmlLivingExample();

            //单表反序列化,返回值也是bool形
            XmlTest <XmlLivingExample> .DSerialize(ref XLE_DS, "Config.xml", ref erro);

            XmlLivingExample XLE1 = new XmlLivingExample();

            XLE1.HouseNo    = 5;
            XLE1.StreetName = "Rohini1";
            XLE1.City       = "Delhi2";
            XLE1.PoAddress  = "asd";
            ar.HouseNo      = XLE1.HouseNo * 2;
            ar.Data         = XLE1.StreetName;
            XLE1.Address    = ar;
            List <XmlLivingExample> LXE = new List <XmlLivingExample>();

            LXE.Add(XLE); LXE.Add(XLE1);
            //判断写入多表xml是否成功
            if (!XmlTest <XmlLivingExample> .Serialize(LXE, "Config.xml", ref erro))
            {
                MessageBox.Show(erro);
            }
            //多表反序列化,返回值也是bool形
            List <XmlLivingExample> Test = new List <XmlLivingExample>();

            XmlTest <XmlLivingExample> .DSerializeList(ref Test, "Config.xml", ref erro);
        }
Пример #8
0
        public void XMLRquestHandling(BlockingQueue <string> b)
        {
            XmlTest x = new XmlTest();
            Creator c = new Creator();


            for (int i = 0; i < b.size(); i++)
            {
                Console.Write("\n------------Dequeueing Test Requests---------------\n");
                string      TestRequest = b.deQ();
                List <Test> testList_   = x.parse(TestRequest);
                c.AppDomainCreator(testList_);
                List <TestResults> results = c.getResults();
                resultsBlockingQueue.enQ(results);
            }
        }
Пример #9
0
        public Tests()
        {
            InitializeComponent();

            XMLTest = new XmlTest(new XmlUtil(DataGridTests));

            XMLProyect = new XmlProyect(new XmlUtil());

            XMLTest.UpdateDataGrid();

            UpdateListProyects();

            UpdateListEnverioments();

            UpdateListMethod();
        }
Пример #10
0
 /// <summary>
 /// 检查config文件是否存在,不存在则创建
 /// </summary>
 private void init()
 {
     if (!File.Exists("Config.xml"))
     {
         SqlData sd = new SqlData();
         sd.connStr  = TextProcessing.SuperEncrypt("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}; Jet OLEDB:Database Password ={1}", "zjsxzsta", "zjsxzstb");
         sd.honeybee = TextProcessing.SuperEncrypt("", "zjsxzsta", "zjsxzstb");
         string erro = "";
         //判断写入单表xml是否成功
         if (!XmlTest <SqlData> .Serialize(sd, "Config.xml", ref erro))
         {
             MessageBox.Show(erro);
         }
         //FilesClasses.InitXml();
     }
 }
Пример #11
0
        static void Main(string[] args)
        {
            JsonTest.Test();

            XmlTest.Test();

            // TaskTest.Test();

            //LinqTest.Test();
            //DelegatesTest.Test();

            //ExtensionMethodTest.Test();

            //QueueStackTest.Test();
            //CollectionTest.Test();

            //ArrayTest.Test();

            //GenericTypesMethodTest();
            //GenericTypesClassTest();
        }
Пример #12
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!File.Exists("Config.xml"))
     {
         SqlData sd = new SqlData();
         sd.connStr  = TextProcessing.SuperEncrypt(textBox1.Text, "zjsxzsta", "zjsxzstb");
         sd.honeybee = TextProcessing.SuperEncrypt(textBox2.Text, "zjsxzsta", "zjsxzstb");
         string erro = "";
         //判断写入单表xml是否成功
         if (!XmlTest <SqlData> .Serialize(sd, "Config.xml", ref erro))
         {
             MessageBox.Show(erro);
         }
         //if(FilesClasses.InitXml(textBox1.Text, textBox2.Text))
         //{
         //    textBox2.Text = "";
         //    textBox1.Text = "";
         //}
         //else
         //{
         //    MessageBox.Show("保存错误!");
         //}
     }
 }
Пример #13
0
 public void FixtureSetUp()
 {
     unit = new XmlTest();
 }
Пример #14
0
 public static void ClearTestRunLog()
 {
     _lastTestRun = null;
     _lastTest    = null;
     _nextTestId  = 0;
 }
Пример #15
0
 internal static void StartNewTest()
 {
     _lastTest = new XmlTest();
     CurrentTestRun.AddTest(_lastTest);
 }
Пример #16
0
 private void OnStartup(object sender, StartupEventArgs e)
 {
     XmlTest.Start();
 }