public void testStaffPersonalASTF() { IDictionary values = new Hashtable(); values.Add( "ASTF.STAFFNUM", "9847" ); values.Add( "ASTF.SOCSECNUM", "123456789" ); values.Add( "ASTF.SCHOOLNUM", "999" ); values.Add( "ASTF.SCHOOLNUM2", "999" ); values.Add( "ASTF.HOMEROOM", "8" ); values.Add( "ASTF.EMAILADDR", null ); values.Add( "ASTF.LASTNAME", "Ngo" ); values.Add( "ASTF.FIRSTNAME", "Tom" ); values.Add( "ASTF.MIDDLENAME", "C" ); values.Add( "ASTF.ADDRESS", "1232 Bateman Point Drive" ); values.Add( "ASTF.CITY", "West Jordan" ); values.Add( "ASTF.STATE", "Utah" ); values.Add( "ASTF.COUNTRY", "" ); values.Add( "ASTF.ZIPCODE", "84084" ); values.Add( "ASTF.SCHOOLTEL", "1234567890" ); values.Add( "ASTF.TELEXTN", null ); values.Add( "ASTF.HOMETEL", null ); values.Add( "ASTF.ETHNICCODE", "W" ); StringMapAdaptor sma = new StringMapAdaptor( values ); StaffPersonal s = new StaffPersonal(); Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null, null, null ); m.MapOutbound( sma, s, SifVersion.SIF15r1 ); Console.WriteLine( s.ToXml() ); Element e = s .GetElementOrAttribute( "PhoneNumber[@Format='NA' and @Type='HP']" ); Assertion.AssertNull( "Home PhoneNumber should not be mapped", e ); e = s.GetElementOrAttribute( "PhoneNumber[@Format='NA' and @Type='WP']" ); Assertion.AssertNotNull( "School PhoneNumber should be mapped", e ); Assertion.AssertEquals( "School phone", "1234567890", e.TextValue ); }
public void testStaffPersonalATCH() { IDictionary values = new Hashtable(); values.Add( "ATCH.TCHNUM", "98" ); values.Add( "ATCH.SOCSECNUM", "455128888" ); values.Add( "ATCH.SCHOOLNUM", "999" ); values.Add( "ATCH.SCHOOLNUM2", "999" ); values.Add( "ATCH.HOMEROOM", "5" ); values.Add( "ATCH.LASTNAME", "Ngo" ); values.Add( "ATCH.FIRSTNAME", "Van" ); values.Add( "ATCH.MIDDLENAME", null ); values.Add( "ATCH.TELEPHONE", "8011234567" ); values.Add( "ATCH.TELEXTN", null ); values.Add( "ATCH.EMAILADDR", null ); values.Add( "ATCH.ETHNIC", "W" ); StringMapAdaptor sma = new StringMapAdaptor( values ); StaffPersonal s = new StaffPersonal(); Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null, null, null ); m.MapOutbound( sma, s, SifVersion.SIF15r1 ); Console.WriteLine( s.ToXml() ); }
public void testStaffPersonalATCHNullPhone() { IDictionary values = new Hashtable(); values.Add( "ATCH.TCHNUM", "98" ); values.Add( "ATCH.SOCSECNUM", "455128888" ); values.Add( "ATCH.SCHOOLNUM", "999" ); values.Add( "ATCH.SCHOOLNUM2", "999" ); values.Add( "ATCH.HOMEROOM", "5" ); values.Add( "ATCH.LASTNAME", "Ngo" ); values.Add( "ATCH.FIRSTNAME", "Van" ); values.Add( "ATCH.MIDDLENAME", null ); values.Add( "ATCH.TELEPHONE", null ); values.Add( "ATCH.TELEXTN", null ); values.Add( "ATCH.EMAILADDR", null ); values.Add( "ATCH.ETHNIC", "W" ); StringMapAdaptor sma = new StringMapAdaptor( values ); StaffPersonal s = new StaffPersonal(); Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null, null, null ); m.MapOutbound( sma, s, SifVersion.SIF15r1 ); Console.WriteLine( s.ToXml() ); Element e = s .GetElementOrAttribute( "PhoneNumber[@Format='NA' and @Type='WP']" ); Assertion.AssertNull( "PhoneNumber should be null", e ); }
public void testCountryCodeStaffPersonal() { String customMappings = "<agent id='Repro' sifVersion='2.0'>" + " <mappings id='Default'>" + " <object object='StaffPersonal'>" + " <field name='ASTF.COUNTRY' sifVersion='+2.0'>AddressList/Address[@Type='0123']/Country=US</field>" + " <field name='ASTF.COUNTRY' sifVersion='-1.5r1'>Address[@Type='M']/Country[@Code='US']</field>" + "</object></mappings></agent>"; Adk.SifVersion = SifVersion.SIF15r1; IDictionary map = new Hashtable(); map.Add( "ASTF.COUNTRY", "" ); StringMapAdaptor sma = new StringMapAdaptor( map ); StaffPersonal obj = new StaffPersonal(); doOutboundMapping( sma, obj, customMappings, null ); assertAddressWithCountry( obj.AddressList, "US" ); }