Exemplo n.º 1
0
 public virtual void testSerializeEnvelope()
 {
     try
     {
         java.io.ByteArrayOutputStream   streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream      oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.Envelope pt        = new com.esri.core.geometry.Envelope(10, 10,
                                                                                         400, 300);
         oo.writeObject(pt);
         java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut
                                                                                  .toByteArray());
         java.io.ObjectInputStream       ii    = new java.io.ObjectInputStream(streamIn);
         com.esri.core.geometry.Envelope ptRes = (com.esri.core.geometry.Envelope)ii.readObject
                                                     ();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         fail("Envelope serialization failure");
     }
     // try
     // {
     // FileOutputStream streamOut = new FileOutputStream(m_thisDirectory +
     // "savedEnvelope.txt");
     // ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     // Envelope pt = new Envelope(10, 10, 400, 300);
     // oo.writeObject(pt);
     // }
     // catch(Exception ex)
     // {
     // fail("Envelope serialization failure");
     // }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedEnvelope.txt");
         java.io.ObjectInputStream       ii    = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.Envelope ptRes = (com.esri.core.geometry.Envelope)ii.readObject
                                                     ();
         NUnit.Framework.Assert.IsTrue(ptRes.getXMax() == 400);
     }
     catch (System.Exception)
     {
         fail("Envelope serialization failure");
     }
 }