public void testCountryCodeLEAInfo() { Adk.SifVersion = SifVersion.SIF15r1; String customMappings = "<agent id='Repro' sifVersion='2.0'>" + " <mappings id='Default'>" + " <object object='LEAInfo'>" + " <field name='DISTRICT_COUNTRY' sifVersion='+2.0'>AddressList/Address[@Type='0123']/Country=US</field>" + " <field name='DISTRICT_COUNTRY' sifVersion='-1.5r1'>Address[@Type='07']/Country[@Code='US']</field>" + " <field name='CONTACT_PHONE' sifVersion='+2.0'>LEAContactList/LEAContact/ContactInfo/PhonenumberList/PhoneNumber[@Type='0096']/Number</field>" + " <field name='CONTACT_PHONE' sifVersion='-1.5r1'>LEAContact/ContactInfo/PhoneNumber[@Format='NA',@Type='TE']</field>" + "</object></mappings></agent>"; Adk.SifVersion = SifVersion.SIF15r1; IDictionary map = new Hashtable(); map.Add( "DISTRICT_COUNTRY", null ); map.Add( "CONTACT_PHONE", "801.550.2796" ); StringMapAdaptor sma = new StringMapAdaptor( map ); LEAInfo obj = new LEAInfo(); doOutboundMapping( sma, obj, customMappings, null ); Assertion.AssertNull( "Address should be null", obj.AddressList ); ContactInfo ci = (ContactInfo) obj .GetElementOrAttribute( "LEAContact/ContactInfo" ); PhoneNumber phone = ci.PhoneNumberList.ItemAt( 0 ); Assertion.AssertNotNull( "Phone was not set", phone ); Assertion.AssertEquals( "Format", "NA", phone.Format ); Assertion.AssertEquals( "Type", "TE", phone.Type ); Assertion.AssertEquals( "Format", "801.550.2796", phone.Number ); }
public void testLEAInfoPhones() { String customMappings = "<agent id='Repro' sifVersion='2.0'>" + " <mappings id='Default'>" + " <object object='LEAInfo'>" + " <field name='DISTRICT_PHONE' sifVersion='-1.5r1'>PhoneNumber[@Format='NA',@Type='TE']</field>" + " <field name='CONTACT_PHONE' sifVersion='-1.5r1'>LEAContact/ContactInfo/PhoneNumber[@Format='NA',@Type='TE']</field>" + "</object></mappings></agent>"; Adk.SifVersion = SifVersion.SIF15r1; IDictionary map = new Hashtable(); map.Add( "DISTRICT_PHONE", "912-555-6658" ); map.Add( "CONTACT_PHONE", "912-888-6658" ); StringMapAdaptor sma = new StringMapAdaptor( map ); LEAInfo obj = new LEAInfo(); doOutboundMapping( sma, obj, customMappings, null ); PhoneNumberList pnl = obj.PhoneNumberList; Assertion.AssertNotNull( "LeaInfo/PhoneNumberList is Null", pnl ); PhoneNumber phone = obj.PhoneNumberList.ItemAt( 0 ); Assertion.AssertEquals( "Format", "NA", phone.Format ); Assertion.AssertEquals( "Type", "TE", phone.Type ); Assertion.AssertEquals( "Number", "912-555-6658", phone.Number ); LEAContact contact = obj.LEAContactList.ItemAt( 0 ); phone = contact.ContactInfo.PhoneNumberList.ItemAt( 0 ); Assertion.AssertEquals( "Contact Format", "NA", phone.Format ); Assertion.AssertEquals( "Contact Type", "TE", phone.Type ); Assertion.AssertEquals( "Contact Number", "912-888-6658", phone.Number ); }