Example #1
0
        public void SDOParse()
        {
            // Create a StudentPersonal
            StudentPersonal sp = ObjectCreator.CreateStudentPersonal();

            // Test changing the name
            sp.Name = new Name(NameType.BIRTH, "STUDENT", "JOE");

            sp = AdkObjectParseHelper.runParsingTest(sp, SifVersion.SIF15r1);

            // Test to ensure that Email is not a child of StudentPersonal
            Assertion.AssertEquals("No StudentPersonal/Email", 0, sp.GetChildList(CommonDTD.EMAIL).Count);
            Assertion.AssertNotNull("StudentPersonal/EmailList", sp.EmailList);
            Assertion.Assert("StudentPersonal/EmailList/Email", sp.EmailList.ChildCount > 0);

            sp = AdkObjectParseHelper.runParsingTest(sp, SifVersion.SIF20);

            // Test to ensure that Email is not a child of StudentPersonal
            Assertion.AssertEquals("No StudentPersonal/Email", 0, sp.GetChildList(CommonDTD.EMAIL).Count);
            Assertion.AssertNotNull("StudentPersonal/EmailList", sp.EmailList);
            Assertion.Assert("StudentPersonal/EmailList/Email", sp.EmailList.ChildCount > 0);
            sp = AdkObjectParseHelper.runParsingTest(sp, SifVersion.SIF11);

            // Test to ensure that Email is not a child of StudentPersonal
            Assertion.AssertEquals("No StudentPersonal/Email", 0, sp.GetChildList(CommonDTD.EMAIL).Count);
            Assertion.AssertNotNull("StudentPersonal/EmailList", sp.EmailList);
            Assertion.Assert("StudentPersonal/EmailList/Email", sp.EmailList.ChildCount > 0);

            sp = AdkObjectParseHelper.runParsingTest(sp, SifVersion.SIF22);

            // Test to ensure that Email is not a child of StudentPersonal
            Assertion.AssertEquals("No StudentPersonal/Email", 0, sp.GetChildList(CommonDTD.EMAIL).Count);
            Assertion.AssertNotNull("StudentPersonal/EmailList", sp.EmailList);
            Assertion.Assert("StudentPersonal/EmailList/Email", sp.EmailList.ChildCount > 0);
        }
Example #2
0
        public void testStudentPersonal2Addresses20r1()
        {
            IDictionary values = new Hashtable();

            values.Add("PERMNUM", "9798");
            values.Add("LASTNAME", "Doe");
            values.Add("FIRSTNAME", "Jane");
            values.Add("MIDDLENAME", null);
            values.Add("MAILADDR", "PO Box 80077");
            values.Add("CITY", "Salt Lake City");
            values.Add("STATE", "Utah");
            values.Add("COUNTRY", "US");
            values.Add("ZIPCODE", "84093");
            values.Add("RESADDR", "528 Big CottonWood Rd");
            values.Add("RESCITY", "Sandy");
            values.Add("RESSTATE", "UT");
            values.Add("RESCOUNTRY", "US");
            values.Add("RESZIPCODE", "84095");

            StringMapAdaptor sma = new StringMapAdaptor(values);
            StudentPersonal  sp  = new StudentPersonal();

            Mappings m = fCfg.Mappings.GetMappings("Default").Select(null,
                                                                     null, null);

            m.MapOutbound(sma, sp, SifVersion.SIF20r1);

            Console.WriteLine(sp.ToXml());

            Element e = sp
                        .GetElementOrAttribute("AddressList/Address[@Type='0123']/Street/Line1");

            Assertion.AssertNotNull("Mailing Address was not mapped ", e);
            Assertion.AssertEquals("Mailing Address", "PO Box 80077", e.TextValue);

            e = sp
                .GetElementOrAttribute("AddressList/Address[@Type='0765']/Street/Line1");
            Assertion.AssertNotNull("Residential Address was not mapped ", e);
            Assertion.AssertEquals("Mailing Address", "528 Big CottonWood Rd", e
                                   .TextValue);

            StudentAddressList[] list     = sp.AddressLists;
            SifElementList       children = sp.GetChildList(CommonDTD.ADDRESSLIST);

            Assertion.AssertEquals("Should have one StudentAddress elements", 1,
                                   children.Count);
            Assertion.AssertEquals("Should have two address elements", 2, children[0].ChildCount);
        }