public void testStudentPersonal2Addresses15r1() { 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.SIF15r1); Console.WriteLine(sp.ToXml()); Element e = sp .GetElementOrAttribute( "StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='M']/Street/Line1"); Assertion.AssertNotNull("Mailing Address was not mapped ", e); Assertion.AssertEquals("Mailing Address", "PO Box 80077", e.TextValue); e = sp .GetElementOrAttribute( "StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='P']/Street/Line1"); Assertion.AssertNotNull("Residential Address was not mapped ", e); Assertion.AssertEquals("Mailing Address", "528 Big CottonWood Rd", e .TextValue); StudentAddressList children = sp.AddressList; Assertion.AssertEquals("Should have two StudentAddress elements", 2, children.Count); }
public void testCountryCodeStudentPersonal() { Adk.SifVersion = SifVersion.SIF15r1; String customMappings = "<agent id='Repro' sifVersion='2.0'>" + " <mappings id='Default'>" + " <object object='StudentPersonal'>" + " <field name='COUNTRY' sifVersion='+2.0'>AddressList/Address[@Type='0769']/Country=US</field>" + " <field name='COUNTRY' sifVersion='-1.5r1'>StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='M']/Country[@Code='UK']</field>" + " <field name='RESCOUNTRY' sifVersion='+2.0'>AddressList/Address[@Type='0765']/Country=US</field>" + " <field name='RESCOUNTRY' sifVersion='-1.5r1'>StudentAddress[@PickupOrDropoff='NA',@DayOfWeek='NA']/Address[@Type='P']/Country[@Code='US']</field>" + "</object></mappings></agent>"; Adk.SifVersion = SifVersion.SIF15r1; IDictionary map = new Hashtable(); map.Add("RESCOUNTRY", ""); map.Add("COUNTRY", ""); StringMapAdaptor sma = new StringMapAdaptor(map); StudentPersonal sp = new StudentPersonal(); doOutboundMapping(sma, sp, customMappings, null); StudentAddressList sal = sp.AddressList; Assertion.AssertNotNull("StudentAddressList is null", sal); Assertion.AssertEquals( "StudentAddressList does not contain two address list types", 2, sal.ChildCount); assertCountry((Address)sp .GetElementOrAttribute("StudentAddress/Address[@Type='P']"), "US"); assertCountry((Address)sp .GetElementOrAttribute("StudentAddress/Address[@Type='M']"), "UK"); }
// BEGIN EXTRA METHODS (C:/dev/OpenADK-java/adk-generator/datadef/us/sif20/StudentPersonal.txt.cs) /// <summary> /// Adds a StudentAddressList instance for interoperating with multiple addresses in SIF Version 1.x /// </summary> /// <remarks> /// <para>In SIF 2.0, the StudentAddressList object is not a repeatable element. Use this method of adding /// student address only if you are creating an object for use in SIF 1.x /// </para> /// <para>In SIF 2.0, or if you are only dealing with a single Student address, you can add the address /// to the StudentPersonal object by calling the <see cref="StudentAddressList#Add"/> method /// </remarks> /// <param name="value"></param> public void AddAddressList( StudentAddressList value ) { AddChild( StudentDTD.STUDENTPERSONAL_ADDRESSLIST, value); }