public void testStudentPersonalSIF15r1() { IDictionary values = new Hashtable(); values.Add("PERMNUM", "9798"); values.Add("SOCSECNUM", "845457898"); values.Add("SCHOOLNUM", "999"); values.Add("SCHOOLNUM2", "999"); values.Add("GRADE", "09"); values.Add("HOMEROOM", "5"); values.Add("LASTNAME", "Doe"); values.Add("FIRSTNAME", "Jane"); values.Add("MIDDLENAME", null); values.Add("NICKNAME", null); values.Add("MAILADDR", "5845 Test Blvd"); values.Add("CITY", "slc"); values.Add("STATE", "Utah"); values.Add("COUNTRY", ""); values.Add("ZIPCODE", "84093"); values.Add("RESADDR", null); values.Add("RESCITY", null); values.Add("RESSTATE", null); values.Add("RESCOUNTRY", null); values.Add("RESZIPCODE", null); values.Add("BIRTHDATE", "20051209"); values.Add("GENDER", "F"); values.Add("ETHNICCODE", "W"); values.Add("ENGPROF", ""); values.Add("PRIMARYLNG", ""); values.Add("TELEPHONE", null); 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()); OtherIdList oil = sp.OtherIdList; bool gradeMappingFound = false; foreach (OtherId oid in oil) { if ("ZZ".Equals(oid.Type) && oid.Value.StartsWith("GRADE")) { Assertion.AssertEquals("OtherId[@Type=ZZ]GRADE: mapping", "GRADE:09", oid.Value); gradeMappingFound = true; } } Assertion.Assert("GradeMapping found", gradeMappingFound); }
public void testOtherIdsNullValues() { String customMappings = "<agent id='Repro' sifVersion='2.0'>" + " <mappings id='Default'>" + " <object object='StudentPersonal'>" + " <field name='PERMNUM' sifVersion='+2.0'>OtherIdList/OtherId[@Type='0593']</field>" + " <field name='PERMNUM' sifVersion='-1.5r1'>OtherId[@Type='06']</field>" + " <field name='PERMNUM' sifVersion='+1.5'>LocalId</field>" + " <field name='SOCSECNUM' sifVersion='+2.0'>OtherIdList/OtherId[@Type='0004']</field>" + " <field name='SOCSECNUM' sifVersion='-1.5r1'>OtherId[@Type='SY']</field>" + " <field name='SCHOOLNUM' sifVersion='+2.0'>OtherIdList/OtherId[@Type='9999'+]=SCHOOL:$(SCHOOLNUM)</field>" + " <field name='SCHOOLNUM' sifVersion='-1.5r1'>OtherId[@Type='ZZ'+]=SCHOOL:$(SCHOOLNUM)</field>" + "</object></mappings></agent>"; Adk.SifVersion = SifVersion.SIF15r1; IDictionary map = new Hashtable(); map.Add("PERMNUM", "123456"); map.Add("SOCSECNUM", null); map.Add("SCHOOLNUM", "2"); StringMapAdaptor sma = new StringMapAdaptor(map); StudentPersonal obj = new StudentPersonal(); doOutboundMapping(sma, obj, customMappings, null); OtherIdList list = obj.OtherIdList; Assertion.AssertNotNull("OtherIdList is null", list); OtherId oId = list["06"]; Assertion.AssertNotNull("PERMNUM", oId); Assertion.AssertEquals("PERMNUM", "123456", oId.Value); // The SOCSECNUM was NULL, so it should not produce an element oId = list["SY"]; Assertion.AssertNull("SOCSECNUM", oId); oId = list["ZZ"]; Assertion.AssertNotNull("SCHOOLNUM", oId); Assertion.AssertEquals("SCHOOLNUM", "SCHOOL:2", oId.Value); }
public static StudentPersonal CreateStudentPersonal() { StudentPersonal sp = new StudentPersonal(); AlertMessages alm = new AlertMessages(); alm.AddAlertMessage(AlertMessageType.LEGAL, "This is the Legal Alert for Joe Student"); sp.AlertMessages = alm; // TODO: Consider adding helper methods to the ADK that allow // list elements to be set or gotten from the parent? OtherIdList oidList = new OtherIdList(); oidList.AddOtherId(OtherIdType.SIF1x_OTHER, "P00001"); oidList.AddOtherId(OtherIdType.SIF1x_HEATH_RECORD, "WB0025"); oidList.AddOtherId(OtherIdType.SIF1x_SSN, "123-45-6789"); sp.OtherIdList = oidList; Name name = new Name(NameType.BIRTH, "Student", "Joe"); name.MiddleName = ""; name.PreferredName = "Joe"; sp.Name = name; EmailList elist = new EmailList(); elist.AddEmail(EmailType.PRIMARY, "*****@*****.**"); sp.EmailList = elist; sp.OnTimeGraduationYear = 1982; Demographics demo = new Demographics(); demo.BirthDate = new DateTime(1981, 12, 20); demo.SetCitizenshipStatus(CitizenshipStatus.USCITIZEN); CountriesOfCitizenship countries = new CountriesOfCitizenship(); countries.AddCountryOfCitizenship(CountryCode.US); countries.AddCountryOfCitizenship(CountryCode.Wrap("CA")); demo.CountriesOfCitizenship = countries; demo.SetCountryOfBirth(CountryCode.US); CountriesOfResidency cre = new CountriesOfResidency(new Country(CountryCode.IE)); demo.CountriesOfResidency = cre; demo.SetStateOfBirth(StatePrCode.AK); sp.Demographics = demo; Address addr = new Address(); addr.City = "Salt Lake City"; addr.SetStateProvince(StatePrCode.UT); addr.SetCountry(CountryCode.US); addr.PostalCode = "84102"; Street str = new Street(); str.Line1 = "1 IBM Plaza"; str.ApartmentNumber = "2000"; str.Line2 = "Suite 2000"; str.Line3 = "Salt Lake City, UT 84102"; str.StreetName = "IBM"; str.StreetNumber = "1"; str.StreetType = "Plaza"; str.ApartmentType = "Suite"; addr.Street = str; sp.AddAddressList(PickupOrDropoff.NA, "MoTuWeThFrSaSu", addr); PhoneNumberList plist = new PhoneNumberList(); plist.AddPhoneNumber(PhoneNumberType.SIF1x_HOME_PHONE, "(312) 555-1234"); sp.PhoneNumberList = plist; // Test changing the name sp.SetName(NameType.BIRTH, "STUDENT", "JOE"); return(sp); }