public void TestWCharSetDefinedServer() {
            byte[] sourceContent = 
                new byte[] {
                             0, 0, 0, 5, 3, 0, 0, 0,
                             0, 0, 0, 0, 
                             0, 0, 0, 7, 116, 101, 115, 116,
                             117, 114, 105, 0,
                             0, 0, 0, 12, 69, 99, 104, 111, 
                             87, 83, 116, 114, 105, 110, 103, 0,
                             0, 0, 0, 1, 0, 0, 0, 1,
                             0, 0, 0, 12, 0, 0, 0, 0,
                             0, 1, 0, 1, 0, 1, 1, 9,
                             0, 0, 0, 8, 0, 116, 0, 101,
                             0, 115, 0, 116};
            MemoryStream sourceStream =
                new MemoryStream(sourceContent);
            
            // create a connection context: this is needed for request deserialisation
            GiopConnectionDesc conDesc = new GiopConnectionDesc(null, null);

            // go to stream begin
            sourceStream.Seek(0, SeekOrigin.Begin);
            
            GiopMessageBodySerialiser ser = new GiopMessageBodySerialiser(
                                                new ArgumentsSerializerFactory(m_serFactory));
            
            CdrInputStreamImpl cdrSourceStream = 
                new CdrInputStreamImpl(sourceStream);
            cdrSourceStream.ConfigStream(0, new GiopVersion(1, 2));
            cdrSourceStream.SetMaxLength((uint)sourceContent.Length);
 
            IMessage result = null;
            TestStringInterfaceImpl service = new TestStringInterfaceImpl();
            try {
                // object which should be called
                string uri = "testuri";
                RemotingServices.Marshal(service, uri);

                // deserialise request message
                result = ser.DeserialiseRequest(cdrSourceStream, new GiopVersion(1,2),
                                                conDesc, InterceptorManager.EmptyInterceptorOptions);
            } finally {
                RemotingServices.Disconnect(service);
            }

            // now check if values are correct
            Assert.IsTrue(result != null, "deserialised message is null");
            object[] args = (object[])result.Properties[SimpleGiopMsg.ARGS_KEY];
            Assert.IsTrue(args != null, "args is null");
            Assert.AreEqual(1, args.Length);
            Assert.AreEqual("test", args[0]);
        }
        public void TestWCharSetNotDefinedServer() {
            byte[] sourceContent = 
                new byte[] {
                             0, 0, 0, 5, 3, 0, 0, 0,
                             0, 0, 0, 0, 
                             0, 0, 0, 7, 116, 101, 115, 116,
                             117, 114, 105, 0,
                             0, 0, 0, 12, 69, 99, 104, 111, 
                             87, 83, 116, 114, 105, 110, 103, 0,
                             0, 0, 0, 0, 0, 0, 0, 0, 
                             0, 0, 0, 8, 0, 116, 0, 101,
                             0, 115, 0, 116};
            MemoryStream sourceStream =
                new MemoryStream(sourceContent);
            
            // create a connection context: this is needed for request deserialisation
            GiopConnectionDesc conDesc = new GiopConnectionDesc(null, null);

            // go to stream begin
            sourceStream.Seek(0, SeekOrigin.Begin);
            
            GiopMessageBodySerialiser ser = new GiopMessageBodySerialiser(
                                                new ArgumentsSerializerFactory(m_serFactory));
            
            CdrInputStreamImpl cdrSourceStream = 
                new CdrInputStreamImpl(sourceStream);
            cdrSourceStream.ConfigStream(0, new GiopVersion(1, 2));
            cdrSourceStream.SetMaxLength((uint)sourceContent.Length);
 
            IMessage result = null;
            TestStringInterfaceImpl service = new TestStringInterfaceImpl();
            try {
                // object which should be called
                string uri = "testuri";
                RemotingServices.Marshal(service, uri);

                // deserialise request message
                result = ser.DeserialiseRequest(cdrSourceStream, new GiopVersion(1,2),
                                                conDesc, InterceptorManager.EmptyInterceptorOptions);
                Assert.Fail("no exception, although code set not set");
            } catch (RequestDeserializationException rde) {
                Assert.NotNull(rde.Reason, "rde inner exception");
                Assert.AreEqual(typeof(BAD_PARAM), rde.Reason.GetType(), "rde type");
            } finally {
                RemotingServices.Disconnect(service);
            }
        }