Ejemplo n.º 1
0
        public void Should_be_bale_to_close_a_stream()
        {
            IStreamAdapter streamAdapter = new StreamAdapter();
             streamAdapter.Initialize();

             streamAdapter.Close();
        }
Ejemplo n.º 2
0
 public void Should_be_able_to_initialize_an_StreamAdapter_with_a_given_type()
 {
     IStreamAdapter theUnit = new StreamAdapter();
      theUnit.Initialize();
      Stream stream = theUnit.Stream;
      bool isOpen = theUnit.IsOpen;
 }
Ejemplo n.º 3
0
        public void Should_be_able_to_serialize_an_object_of_the_same_type_that_was_initialized()
        {
            IStreamAdapter streamAdapter = new StreamAdapter();
             streamAdapter.Initialize();

             FakeObject fakey = new FakeObject();
             fakey.ObjectName = "Fakey";
             fakey.ObjectDescription = "Test object";
             fakey.ObjectID = Guid.NewGuid();

             ISerializeAdapter theUnit = new XMLSerializeAdapter();
             theUnit.Initialize(typeof(FakeObject));
             theUnit.Serialize(streamAdapter, fakey);
        }
Ejemplo n.º 4
0
        public void Should_be_able_to_deserialize_an_object_of_the_same_type_that_was_initialized()
        {
            IStreamAdapter streamAdapter = new StreamAdapter();
             streamAdapter.Initialize();

             FakeObject fakey = new FakeObject();
             fakey.ObjectName = "Fakey";
             fakey.ObjectDescription = "Test object";
             fakey.ObjectID = Guid.NewGuid();

             ISerializeAdapter theUnit = new BinarySerializeAdapter();
             theUnit.Initialize(typeof(FakeObject));
             theUnit.Serialize(streamAdapter, fakey);
             byte[] bResult = streamAdapter.ReadBinary();

             streamAdapter.Initialize();
             streamAdapter.WriteBinary(bResult);
             object result = theUnit.Deserialize(streamAdapter);
        }
Ejemplo n.º 5
0
        public void Will_initialize_the_stream_prior_to_Writing()
        {
            IStreamAdapter streamAdapter = new StreamAdapter();
             FakeObject fakey = new FakeObject();
             fakey.ObjectName = "Fakey";
             fakey.ObjectDescription = "Test object";
             fakey.ObjectID = Guid.NewGuid();

             ISerializeAdapter theUnit = new XMLSerializeAdapter();
             theUnit.Initialize(typeof(FakeObject));
             theUnit.Serialize(streamAdapter, fakey);
             string xmlResult = streamAdapter.ReadString();

             streamAdapter.Initialize();
             streamAdapter.Close();
             streamAdapter.WriteString(xmlResult);
             object result = theUnit.Deserialize(streamAdapter);
        }
Ejemplo n.º 6
0
        public void Will_initialize_the_stream_prior_to_Reading()
        {
            IStreamAdapter streamAdapter = new StreamAdapter();
             streamAdapter.Initialize();
             streamAdapter.Close();

             string xmlResult = streamAdapter.ReadString();
        }