示例#1
0
        /*--------< Deserializes an XML document and constructs objects from the given path and filename >--------------*/
        public void xmlDeserialization <T>(string receivedPath, string xmlFileName)
        {
            ToAndFromXml       xDeserialization = new ToAndFromXml();
            List <TestRequest> newTrq           = xDeserialization.FromXml <List <TestRequest> >(receivedPath, xmlFileName);

            foreach (TestRequest trq in newTrq)
            {
                foreach (string tlb in trq.TestLibraries)
                {
                    _files.Add(tlb);
                }
            }
        }
示例#2
0
        /*--------< Deserializes an XML document, constructs objects and return them. >--------------*/
        public Dictionary <int, List <string> > xmlDeserialization <T>(string receivedPath, string _xmlFileName)
        {
            ToAndFromXml xDeserialization          = new ToAndFromXml();
            BuildRequest newBrq                    = xDeserialization.FromXml <BuildRequest>(receivedPath, _xmlFileName); // Deserialization
            Dictionary <int, List <string> > tests = new Dictionary <int, List <string> >();

            foreach (var test in newBrq.Tests)
            {
                List <string> files = new List <string>();
                files.Add(test.Testfile);
                files.Add(test.TestInterface);
                files.Add(test.Testdriver);
                tests.Add(test.id, files);
            }
            return(tests);
        }
示例#3
0
        static void Main(string[] args)
        {
            ToAndFromXml testSerialization   = new ToAndFromXml();
            ToAndFromXml testDeserialization = new ToAndFromXml();

            Console.WriteLine("Demonstrating XML Serialization and Deserialization");
            Console.Write("\n  attempting to serialize Widget object:");
            List <string> tl          = new List <string>();
            string        builderPath = "../../../Builder/TempDirectory";
            string        xmlFileName = "/BuildRequest.xml";

            Console.Write("\n  attempting to serialize object:");
            testSerialization.ToXml(tl, builderPath);
            Console.Write("\n  attempting to deserialize Widget object:");
            testDeserialization.FromXml <string>(builderPath, xmlFileName);
        }
示例#4
0
        /*--------< Serializes any objects to XML that represents test requests >--------------*/
        public void objSerialization()
        {
            TestRequest tr = new TestRequest();

            _receivePath = _builderPath;
            getFiles("*.dll");
            List <TestRequest> testRequestLists = new List <TestRequest>();
            List <string>      tl = new List <string>();

            foreach (string file in _files)
            {
                Console.WriteLine("file :" + Path.GetFileName(file));
                //tr.TestLibraries = Path.GetFileName(file);
                tl.Add(Path.GetFileName(file));
                tr.TestLibraries = tl;
                testRequestLists.Add(tr);
            }
            ToAndFromXml xSerialization = new ToAndFromXml();

            xSerialization.ToXml(testRequestLists, _builderPath); // Serialization
        }