Ejemplo n.º 1
0
        public static String toATML(CASS_MTPSI tpsi)
        {
            StringWriter      tw         = new StringWriter();
            TestConfiguration testConfig = new TestConfiguration();

            ManufacturerData configManager         = testConfig.ConfigurationManager;
            List <CASS_MTPSICASS_MTPSI_page> pages = tpsi.CASS_MTPSI_page;

            foreach (CASS_MTPSICASS_MTPSI_page page in pages)
            {
                CASS_MTPSICASS_MTPSI_pageUUT uut = page.UUT;
                String partNo = uut.UUT_ID.Part_Number;
                //UUTInstance instance = new UUTInstance();
                UUTDescription item = new UUTDescription();
                //item.Item.name = uut.UUT_ID.Part_Number;

                //Lookup UUT Information
                ItemDescriptionReference reference = new ItemDescriptionReference();
                DocumentReference        docRef    = new DocumentReference();
                //docRef.ID = uut.UUT_ID.Part_Number;
                docRef.uuid = "{SOMEUUIDHERE}";

                reference.Item = docRef;// item.Item;
                //testConfig.TestedUUTs.Add(reference);

                TestConfigurationTestEquipmentItem testEquipment = new TestConfigurationTestEquipmentItem();

                foreach (CASS_MTPSICASS_MTPSI_pageATE_assets asset in page.ATE_assets)
                {
                    ItemDescriptionReference refEquip   = new ItemDescriptionReference();
                    ItemDescription          instrument = new ItemDescription();
                    instrument.name = asset.Asset_Identifier;
                    refEquip.Item   = instrument;
                    //testEquipment.Instrumentation.Add(refEquip);
                }

                // testConfig.TestEquipment.Add(testEquipment);

                try
                {
                    XmlSerializer serializerObj = new XmlSerializer(typeof(TestConfiguration));
                    serializerObj.Serialize(tw, testConfig);
                }
                catch (Exception e)
                {
                    Exception ie = e.InnerException;
                    while (ie != null)
                    {
                        Trace.WriteLine(ie.Message);
                        ie = ie.InnerException;
                    }
                }
                break;
            }
            return(tw.ToString());
        }