private void assertAddressWithCountry(AddressList list,
                                       String expectedCountryCode)
 {
     Assertion.AssertNotNull("AddressList is null", list);
     Assertion.AssertEquals("Not one address in list", 1, list.Count);
     assertCountry(list.ItemAt(0), expectedCountryCode);
 }
Esempio n. 2
0
        public void TestXsiNill_AllChildrenNil()
        {
            SchoolInfo            si   = new SchoolInfo();
            AddressableObjectName paon = new AddressableObjectName( );

            paon.Description = "The little white school house";
            paon.StartNumber = "321";
            Address      addr = new Address(AddressType.CURRENT, paon);
            GridLocation gl   = new GridLocation();

            gl.SetField(CommonDTD.GRIDLOCATION_PROPERTYEASTING, new SifDecimal(null));
            gl.SetField(CommonDTD.GRIDLOCATION_PROPERTYNORTHING, new SifDecimal(null));
            addr.GridLocation = gl;

            si.AddressList = new AddressList(addr);


            //  Write the object to a file
            Console.WriteLine("Writing to file...");
            using (Stream fos = File.Open("SifWriterTest.Temp.xml", FileMode.Create, FileAccess.Write))
            {
                SifWriter writer = new SifWriter(fos);
                si.SetChanged(true);
                writer.Write(si);
                writer.Flush();
                fos.Close();
            }

            //  Parse the object from the file
            Console.WriteLine("Parsing from file...");
            SifParser p = SifParser.NewInstance();

            using (Stream fis = File.OpenRead("SifWriterTest.Temp.xml"))
            {
                si = (SchoolInfo)p.Parse(fis, null);
            }


            AddressList al = si.AddressList;

            Assert.IsNotNull(al);

            addr = al.ItemAt(0);
            Assert.IsNotNull(addr);

            gl = addr.GridLocation;
            Assert.IsNotNull(gl);

            Assert.IsNull(gl.PropertyEasting);
            Assert.IsNull(gl.PropertyNorthing);

            SimpleField sf = gl.GetField(CommonDTD.GRIDLOCATION_PROPERTYEASTING);

            Assert.IsNotNull(sf);
            Assert.IsNull(sf.Value);

            sf = gl.GetField(CommonDTD.GRIDLOCATION_PROPERTYNORTHING);
            Assert.IsNotNull(sf);
            Assert.IsNull(sf.Value);
        }
 private void assertAddressWithCountry( AddressList list,
                                        String expectedCountryCode )
 {
     Assertion.AssertNotNull( "AddressList is null", list );
     Assertion.AssertEquals( "Not one address in list", 1, list.Count );
     assertCountry( list.ItemAt( 0 ), expectedCountryCode );
 }