Beispiel #1
0
        public void TestSerializationbinder()
        {
            Object       objReturn;
            MemoryStream stream  = new MemoryStream();
            Version1     objVer1 = new Version1(123);

            _soapFormatter.SurrogateSelector = _surrogate;
            _soapFormatter.Serialize(stream, objVer1);

            stream.Position = 0;
            _soapFormatterDeserializer.Binder = new Version1ToVersion2Binder();
            objReturn = _soapFormatterDeserializer.Deserialize(stream);

            Assertion.AssertEquals("#Version1 Version2", "Version2", objReturn.GetType().Name);
            Assertion.AssertEquals("#_value", 123, ((Version2)objReturn)._value);
            Assertion.AssertEquals("#_foo", "Default value", ((Version2)objReturn)._foo);
        }
		public void TestSerializationbinder() {
		    	Object objReturn;
			MemoryStream stream = new MemoryStream();
			Version1 objVer1 = new Version1(123);

			_soapFormatter.SurrogateSelector = _surrogate;
			_soapFormatter.Serialize(stream, objVer1);

			stream.Position = 0;
			_soapFormatterDeserializer.Binder = new Version1ToVersion2Binder();
			objReturn = _soapFormatterDeserializer.Deserialize(stream);

			Assertion.AssertEquals("#Version1 Version2", "Version2", objReturn.GetType().Name);
			Assertion.AssertEquals("#_value", 123, ((Version2) objReturn)._value);
			Assertion.AssertEquals("#_foo", "Default value", ((Version2) objReturn)._foo);
		}