public void testStudentContactSIF15r1()
        {
            StringMapAdaptor sma = createStudentContactFields();
            StudentContact sc = new StudentContact();
            Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null,
                                                                        null, null );
            m.MapOutbound( sma, sc, SifVersion.SIF15r1 );
            String value = sc.ToXml();
            Console.WriteLine( value );

            //	Verify that the phone number is properly escaped
            int loc = value.IndexOf( "<PhoneNumber Format=\"NA\" Type=\"EX\">M&amp;W</PhoneNumber>" );
            Assertion.Assert( "Phone number should be escaped", loc > -1 );

            Element e = sc
                .GetElementOrAttribute( "PhoneNumber[@Format='NA' and @Type='HP']" );
            Assertion.AssertNotNull( "School PhoneNumber should be mapped", e );
            Assertion.AssertEquals( "School phone", "8014504555", e.TextValue );

            e = sc
                .GetElementOrAttribute( "PhoneNumber[@Format='NA' and @Type='AP']" );
            Assertion.AssertNotNull( "School PhoneNumber should be mapped", e );
            // Note the " " Space at the end of the value. This should be there,
            // according to the mapping
            Assertion.AssertEquals( "School phone", "8014505555 ", e.TextValue );

            e = sc
                .GetElementOrAttribute( "PhoneNumber[@Format='NA' and @Type='WP']" );
            Assertion.AssertNull( "School PhoneNumber should not be mapped", e );

            AddressList al = sc.AddressList;
            if ( al != null )
            {
                foreach ( Address addr in al )
                {
                    Assertion.AssertNull( "Country should be null", addr.Country );
                    if ( addr.Type.Equals( "O" ) )
                    {
                        Assertion.AssertNull( "State should be null", addr.StateProvince );
                    }
                }
            }
        }
        public void testStudentContactSIF20()
        {
            Adk.SifVersion = SifVersion.SIF20r1;
            StringMapAdaptor sma = createStudentContactFields();
            StudentContact sc = new StudentContact();
            sc.Type = "E4";
            Mappings m = fCfg.Mappings.GetMappings( "Default" ).Select( null,
                                                                        null, null );
            m.MapOutbound( sma, sc, SifVersion.SIF20r1 );
            String value = sc.ToXml();
            Console.WriteLine( value );

            // Verify that the phone number is properly escaped
            int loc = value.IndexOf( "<Number>M&amp;W</Number>" );
            Assertion.Assert( "Phone number should be escaped", loc > -1 );

            // Verify that the @Type attribute is not rendered in SIF 2.0
            loc = value.IndexOf( "Type=\"E4\"" );
            Assertion.AssertEquals( "Type Attribute should not be rendered", -1, loc );

            sc.SifVersion = SifVersion.SIF20r1;
            Element e = sc
                .GetElementOrAttribute( "//PhoneNumber[@Type='0096']/Number" );
            Assertion.AssertNotNull( "School PhoneNumber should be mapped", e );
            Assertion.AssertEquals( "School phone", "8014504555", e.TextValue );

            e = sc.GetElementOrAttribute( "//PhoneNumber[@Type='0350'][1]/Number" );
            Assertion.AssertNotNull( "School PhoneNumber should be mapped", e );
            // Note the " " Space at the end of the value. This should be there,
            // according to the mapping
            Assertion.AssertEquals( "School phone", "8014505555 ", e.TextValue );

            e = sc.GetElementOrAttribute( "//PhoneNumber[@Type='0350'][2]/Number" );
            Assertion.AssertNull( "School PhoneNumber should not be mapped", e );

            AddressList al = sc.AddressList;
            if ( al != null )
            {
                foreach ( Address addr in al )
                {
                    Assertion.AssertNull( "Country should be null", addr.Country );
                    if ( addr.Type.Equals( "1075" ) )
                    {
                        Assertion.AssertNull( "State should be null", addr.StateProvince );
                    }
                }
            }
        }
        public void testCountryCodeStudentContact()
        {
            String customMappings = "<agent id='Repro' sifVersion='2.0'>"
                                    + "   <mappings id='Default'>"
                                    + "     <object object='StudentContact'>"
                                    +
                                    "		<field name='APRN.COUNTRY' sifVersion='+2.0'>AddressList/Address[@Type='0123']/Country=US</field>"
                                    +
                                    "		<field name='APRN.COUNTRY' sifVersion='-1.5r1'>Address[@Type='M']/Country[@Code='US']</field>"
                                    + "</object></mappings></agent>";

            Adk.SifVersion = SifVersion.SIF15r1;

            IDictionary map = new Hashtable();
            map.Add( "APRN.COUNTRY", null );
            StringMapAdaptor sma = new StringMapAdaptor( map );
            StudentContact obj = new StudentContact();
            doOutboundMapping( sma, obj, customMappings, null );

            Assertion.AssertNull( "AddressList should be null", obj.AddressList );
        }